@dsh-agentic-roleplay/core 0.12.4 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{access-Csp80TFX.js → access-5vtPAT3O.js} +2 -2
- package/lib/{authoring-tools-B_qYKK8c.js → authoring-tools-BpkpGMSO.js} +21 -14
- package/lib/authoring.js +8 -8
- package/lib/{child-DTdY14S9.js → child-Bfj7-Iuo.js} +73 -21
- package/lib/client.js +1688 -1213
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/doctor.js +3 -3
- package/lib/{gallery-Bu6eZMKk.js → gallery-D0h0X7Jy.js} +3 -3
- package/lib/{generator-CTWQWbSW.js → generator-CAJkevKl.js} +2 -2
- package/lib/helper.js +2 -2
- package/lib/{hooks-YXQZ9G2d.js → hooks-P_--KSFl.js} +67 -28
- package/lib/images.js +4 -4
- package/lib/index.js +70 -18
- package/lib/{jail-DVbPSC0R.js → jail-D83JnxKg.js} +2 -2
- package/lib/{library-BmlHNCah.js → library-CnWOHwQl.js} +3 -3
- package/lib/{lorebook-author-tools-C3rRpMt7.js → lorebook-author-tools-CWZ6WRN-.js} +7 -7
- package/lib/lorebook-authoring.js +5 -5
- package/lib/{narration--K2XVIHI.js → narration-DAHmte8p.js} +2 -2
- package/lib/orchestration.js +37 -38
- package/lib/{pack-jail-VbcXiukr.js → pack-jail-DSTyLhMc.js} +15 -15
- package/lib/{packs-CzVh2ZNe.js → packs-D9_N8kDF.js} +2 -2
- package/lib/{presenter-agent-CF3fneuJ.js → presenter-agent-BTpJxmGi.js} +7 -6
- package/lib/{preset-C595KRUM.js → preset-B69AXtip.js} +4 -4
- package/lib/{preset-author-tools-CF_JKKTE.js → preset-author-tools-BJtt7D0J.js} +7 -7
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-ByIQSOKC.js → reflection-2uzE3U-v.js} +9 -9
- package/lib/{serial-ULGUKWsu.js → serial-DnVqMDe5.js} +114 -25
- package/lib/{text-hiKTooVb.js → text-B-HsLdb-.js} +2 -1
- package/lib/{turn-guard-DXMeAJdv.js → turn-guard-D4YHE00t.js} +3 -3
- package/package.json +31 -31
package/lib/compaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as liveSettings, t as decodeOutput } from "./narration
|
|
2
|
-
import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-
|
|
3
|
-
import { t as promptFor } from "./access-
|
|
1
|
+
import { a as liveSettings, t as decodeOutput } from "./narration-DAHmte8p.js";
|
|
2
|
+
import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-Bfj7-Iuo.js";
|
|
3
|
+
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
6
6
|
import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
package/lib/doctor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
|
-
import { A as chatSessionId } from "./child-
|
|
2
|
+
import { A as chatSessionId } from "./child-Bfj7-Iuo.js";
|
|
3
3
|
import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
|
|
4
|
-
import { s as externalTools, t as externalToolLimit } from "./hooks-
|
|
5
|
-
import { a as liveSettings } from "./narration
|
|
4
|
+
import { s as externalTools, t as externalToolLimit } from "./hooks-P_--KSFl.js";
|
|
5
|
+
import { a as liveSettings } from "./narration-DAHmte8p.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as atomicWrite } from "./access-
|
|
2
|
-
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-
|
|
1
|
+
import { n as atomicWrite } from "./access-5vtPAT3O.js";
|
|
2
|
+
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-CnWOHwQl.js";
|
|
3
3
|
import { join, sep } from "node:path";
|
|
4
4
|
import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
5
5
|
// src/host/images/gallery.ts
|
|
@@ -187,4 +187,4 @@ async function updateImage(sessionFolder, path, update) {
|
|
|
187
187
|
}
|
|
188
188
|
export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
|
|
189
189
|
|
|
190
|
-
//# sourceMappingURL=gallery-
|
|
190
|
+
//# sourceMappingURL=gallery-D0h0X7Jy.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-
|
|
1
|
+
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-CnWOHwQl.js";
|
|
2
2
|
// src/host/images/generator.ts
|
|
3
3
|
const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
4
4
|
/** What a reference image shows: the subject and its stable look. */
|
|
@@ -147,4 +147,4 @@ async function generateTransientImage(service, request) {
|
|
|
147
147
|
}
|
|
148
148
|
export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=generator-
|
|
150
|
+
//# sourceMappingURL=generator-CAJkevKl.js.map
|
package/lib/helper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
|
-
import { o as helpers } from "./child-
|
|
2
|
+
import { o as helpers } from "./child-Bfj7-Iuo.js";
|
|
3
3
|
import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
|
|
4
|
-
import { t as registerFoldersJail } from "./jail-
|
|
4
|
+
import { t as registerFoldersJail } from "./jail-D83JnxKg.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
7
7
|
// src/helper.ts
|
|
@@ -1,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-
|
|
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
|
|
3
|
-
import { t as promptFor } from "./access-
|
|
4
|
-
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-
|
|
1
|
+
import { C as addTokens, D as finishOf, E as cutOff, O as estimateAnswer, S as NO_TOKENS, a as childTrace, b as estimateTokens, f as tracerOf, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces, v as requestsOf, x as tokensOf, y as blockText } from "./child-Bfj7-Iuo.js";
|
|
2
|
+
import { _ as emptyStats, a as liveSettings, h as DECISION_SITES, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-DAHmte8p.js";
|
|
3
|
+
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
4
|
+
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
|
|
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
|
-
|
|
4375
|
-
|
|
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(
|
|
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(
|
|
4423
|
+
const minutes = Math.round(Number(whole) * unit[1]);
|
|
4385
4424
|
return {
|
|
4386
4425
|
minutes: minutes >= 1 && minutes <= 525600 ? minutes : void 0,
|
|
4387
|
-
reason:
|
|
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-
|
|
5052
|
+
//# sourceMappingURL=hooks-P_--KSFl.js.map
|
package/lib/images.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as searchImages, c as presentedFor, n as interpretImage, o as tokensOf, r as imageTools, s as present, t as runImagePresenter } from "./presenter-agent-
|
|
2
|
-
import { i as updateImage, r as listGallery } from "./gallery-
|
|
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-
|
|
4
|
-
import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-
|
|
1
|
+
import { a as searchImages, c as presentedFor, n as interpretImage, o as tokensOf, r as imageTools, s as present, t as runImagePresenter } from "./presenter-agent-BTpJxmGi.js";
|
|
2
|
+
import { i as updateImage, r as listGallery } from "./gallery-D0h0X7Jy.js";
|
|
3
|
+
import { c as nextSceneSerial, d as sceneImagePath, l as readImageMetadata, o as entityImageDirectory, s as inheritImages, t as addToLibrary, u as referenceImagePath, v as readPngMetadata, y as withPngMetadata } from "./library-CnWOHwQl.js";
|
|
4
|
+
import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-CAJkevKl.js";
|
|
5
5
|
export { addToLibrary, entityImageDirectory, generateReferenceImage, generateTransientImage, imageTools, inheritImages, interpretImage, listGallery, nextSceneSerial, present, presentedFor, readImageMetadata, readPngMetadata, referenceImagePath, referencePrompt, runImagePresenter, sceneImagePath, searchImages, tokensOf, transientPrompt, updateImage, withPngMetadata };
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { A as chatSessionId, _ as RECOVERY_SHRINK, g as RECOVERY_FLOOR, h as sharedSamplingOf, i as childSamplingOf, j as roleplaySessionOf, m as parseSampling, s as isUnfinishedCall, w as totalTokens } from "./child-
|
|
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-
|
|
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-
|
|
4
|
-
import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-
|
|
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-
|
|
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
|
|
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-
|
|
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-
|
|
9
|
-
import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-
|
|
10
|
-
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-
|
|
11
|
-
import { _ as
|
|
12
|
-
import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-
|
|
13
|
-
import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-
|
|
1
|
+
import { A as chatSessionId, _ as RECOVERY_SHRINK, g as RECOVERY_FLOOR, h as sharedSamplingOf, i as childSamplingOf, j as roleplaySessionOf, m as parseSampling, s as isUnfinishedCall, w as totalTokens } from "./child-Bfj7-Iuo.js";
|
|
2
|
+
import { $ as checkWorld, $t as authoringChatSessionId, A as loadWorldParts, B as localChanges, Gt as cardFormat, H as writeOrigin, J as guardedLookup, Jt as readCard, Kt as isPng, L as describeChanges, O as editWorldInfo, Ot as CHARACTERS_DIR, Qt as authoredWorldOf, R as hashWorld, U as CatalogueError, V as readOrigin, Wt as ImportCardError, X as vetUrl, _ as structureImport, _t as loadLocations, a as beginImport, at as populateClock, c as importTextFor, ct as populateItems, d as knownOutputCeiling, dt as populateLore, et as loadValidatedWorld, f as importPhase, ft as populateRoutines, g as settleDraft, h as markReady, i as ImportState, it as populateCharacters, k as readWorldInfo, kt as loadCharacters, lt as populateKnowledge, m as keepDraft, mt as populateVariables, nt as knowsCharacter, ot as populateDice, pt as populateTriggers, qt as pictureOf, rt as populateCalendar, st as populateFactions, t as AuthoringTools, ut as populateLocations, x as runChecks, z as isUnchanged } from "./authoring-tools-BpkpGMSO.js";
|
|
3
|
+
import { a as lorebookImportMessage, c as readLorebook, d as lorebookOfChat, l as selectEntries, s as previewLorebook, t as LOREBOOK_UPLOAD, u as lorebookChatSessionId } from "./lorebook-author-tools-CWZ6WRN-.js";
|
|
4
|
+
import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-BJtt7D0J.js";
|
|
5
|
+
import { $ as copyWorldPrompts, A as plotProgressOf, B as parsePlotsFile, C as readNotes, G as readDocument, H as COMMANDS_KEY, J as errorMessage, L as readUsage, Q as PromptLibrary, S as notesOfSession, T as defaultBoundaries, V as plotReferenceProblems, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, _ as readTraces, b as readWithdrawn, ct as InvalidStartError, dt as SessionArchivedError, ft as SessionNotFoundError, g as readRunDetail, h as readActivity, it as shippedLanguages, j as populatePlots, k as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readDecisionStats, mt as CommandRefusedError, nt as listFiles, pt as WorldNotFoundError, q as formatIssue, rt as promptProblem, s as externalTools, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote, yt as zoneOf } from "./hooks-P_--KSFl.js";
|
|
6
|
+
import { a as liveSettings, c as writeSettings, d as parseSettings, i as InvalidSettingsError, l as DEFAULT_SETTINGS, o as readSettings, p as WORLD_RULES_KEY, s as useChildReasoning, u as SETTINGS_SPEC } from "./narration-DAHmte8p.js";
|
|
7
|
+
import { B as questionView, Bt as parseThingEdit, Dt as ImportNotFoundError, Et as IMPORT_FOLDER, F as parseWorldInfoEdit, Ft as parseCharacterEdit, G as deletePreset, H as PRESET_FILE, It as parseFactionEdit, J as loadPreset, K as isPresetName, Kt as sourceSummary, Lt as parseLoreEdit, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, Ot as ImportStore, Pt as InvalidEditProblems, Q as savePresetFromWorld, Rt as parsePlaceEdit, Tt as withPlayer, W as createPresetFromShipped, Y as presetDirectory, Z as reservePreset, _t as updateLorebookInfo, at as writeWorldPrompt, cn as parseCharacterFile, ct as deleteLorebook, dn as LORE_SCOPES, dt as isLorebookName, et as updatePresetInfo, ft as listLorebooks, gt as reserveLorebook, it as readWorldPrompt, jt as parseChoices, ln as guarded, lt as deleteLorebookEntry, mt as lorebookDirectory, nt as deleteWorldPrompt, ot as addLorebookEntries, pt as loadLorebook, q as listPresets, rt as listWorldPrompts, st as createLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf, xt as subfolders, z as combineAnswers, zt as parseRelationEdit } from "./serial-DnVqMDe5.js";
|
|
8
|
+
import { $ as languageOfDocuments, A as generateWorldCharacterPortrait, C as editWorldFaction$1, D as editWorldPlots$1, E as editWorldPlace$1, F as uploadWorldCharacterPortrait, G as parseVariablesEdit, I as uploadWorldEntityImage, J as PRESET_FILE$1, K as parseDiceEdit, L as worldCharacterPortraitFile, M as readWorldEditor, N as readWorldTrigger, O as editWorldRelation$1, P as removeWorldTrigger, R as worldEntityImageFile, S as editWorldCharacter$1, T as editWorldNarrationVoice, U as parseCalendarEdit, W as parseRoutineEdit, Y as presetMessage, Z as translateMessage, _ as readCalendarDocument, a as deleteWorldPackFile, at as startUpdate, b as readRoutines, c as createAuthoredEntity, ct as authoringTitle, dt as agentServicesOf, et as readWorldDocuments, f as editCalendar, ft as DOCTOR_OPENING_SOURCE, g as editVariables, h as editRoutine, it as revertUpdate, j as generateWorldEntityImage, k as editWorldThing$1, l as deleteAuthoredEntity, lt as ensureAuthoringChat, m as editDice, mt as appendNarratedTurn, n as packFileProblem, ot as updateStatus, p as editCommands, pt as appendEmptyTurn, q as parseCommandsEdit, st as AuthoringSessions, t as MAX_PACK_TEXT, tt as findTargets, u as readAuthoredEntityDocument, ut as AgentSessions, v as readCommandsDocument, w as editWorldLore$1, x as readVariables, y as readDiceDocument, z as writeWorldTrigger } from "./pack-jail-DSTyLhMc.js";
|
|
9
|
+
import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-5vtPAT3O.js";
|
|
10
|
+
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-B-HsLdb-.js";
|
|
11
|
+
import { _ as pathTo, c as BranchError, d as recordPreset, f as switchPreset, g as childrenOf, h as START_SNAPSHOT, i as reflectionStatus, l as copyPreset, m as writeTimeline, o as TimelineError, p as readTimeline, u as presetStatus, v as snapshotOf } from "./reflection-2uzE3U-v.js";
|
|
12
|
+
import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-B69AXtip.js";
|
|
13
|
+
import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-CnWOHwQl.js";
|
|
14
14
|
import { o as FOLDER_ACCESS, r as InvalidFoldersError, t as StoryFoldersService } from "./service-mRKwpWjX.js";
|
|
15
15
|
import { t as doctorChatSessionId } from "./doctor-chat-hL1a61hp.js";
|
|
16
|
-
import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-
|
|
17
|
-
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-
|
|
18
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
16
|
+
import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-D9_N8kDF.js";
|
|
17
|
+
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CAJkevKl.js";
|
|
18
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-D0h0X7Jy.js";
|
|
19
19
|
import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
|
|
20
20
|
import { SESSION_DATABASE_FILE, addLocalDays, createSessionStore, describeInstant, describeValue, holidaysOn, isSessionId, itemKey, lintWorld, locationKey, openSessionStore, parseInstant, readCalendar, seasonOf, sessionDatabase, sessionFolder, shownVariables, systemTimeZone } from "@dsh-agentic-roleplay/state";
|
|
21
21
|
import { copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -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, {
|
|
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());
|
|
@@ -5127,6 +5131,19 @@ function sessionsRoutes({ sessions, externalTools, redundantLayers }) {
|
|
|
5127
5131
|
throw error;
|
|
5128
5132
|
}
|
|
5129
5133
|
} },
|
|
5134
|
+
"/sessions/branch": { POST: async (req, res) => {
|
|
5135
|
+
const body = await readJsonBody(req);
|
|
5136
|
+
const { chat, parent, atSeq } = typeof body === "object" && body !== null ? body : {};
|
|
5137
|
+
if (typeof chat !== "string" || typeof parent !== "string" || typeof atSeq !== "number" || !Number.isSafeInteger(atSeq) || atSeq < 0) return sendError(res, 400, "the request needs \"chat\", \"parent\" and a whole number \"atSeq\"");
|
|
5138
|
+
try {
|
|
5139
|
+
sendJson(res, 200, await sessions.branch(chat, parent, atSeq));
|
|
5140
|
+
} catch (error) {
|
|
5141
|
+
if (error instanceof SessionNotFoundError) return sendError(res, 404, error.message);
|
|
5142
|
+
if (error instanceof BranchError || error instanceof TimelineError) return sendError(res, 409, error.message);
|
|
5143
|
+
if (error instanceof AgentUnavailableError) return sendError(res, 503, error.message);
|
|
5144
|
+
throw error;
|
|
5145
|
+
}
|
|
5146
|
+
} },
|
|
5130
5147
|
"/sessions/timeline/move": { POST: async (_req, res, url) => {
|
|
5131
5148
|
try {
|
|
5132
5149
|
sendJson(res, 200, await sessions.moveTimeline(url.searchParams.get("id") ?? "", url.searchParams.get("to") ?? ""));
|
|
@@ -5690,6 +5707,32 @@ async function deleteSession(deps, id) {
|
|
|
5690
5707
|
await deps.purgeChat(chatSessionId(id));
|
|
5691
5708
|
deps.state.deleteSession(directory, id);
|
|
5692
5709
|
}
|
|
5710
|
+
// src/host/sessions/branch-session.ts
|
|
5711
|
+
/**
|
|
5712
|
+
* Adopts the story of `parent` into the chat DSH forked for it.
|
|
5713
|
+
*
|
|
5714
|
+
* The fork already made a copy by the time this runs, so a branch that cannot be adopted would leave
|
|
5715
|
+
* a chat with no story behind: it cannot be opened as a story and nothing would ever adopt it. Such a
|
|
5716
|
+
* copy is discarded. An unavailable agent is the exception — the copy is intact and the branch can be
|
|
5717
|
+
* tried again — so it is left in place.
|
|
5718
|
+
*
|
|
5719
|
+
* @throws {SessionNotFoundError} when either chat is not a chat of a story.
|
|
5720
|
+
* @throws {AgentUnavailableError} when the orchestration or the chat of the branch is not running.
|
|
5721
|
+
*/
|
|
5722
|
+
async function branchSession(deps, chat, parent, atSeq) {
|
|
5723
|
+
const id = roleplaySessionOf(chat);
|
|
5724
|
+
if (id === void 0 || roleplaySessionOf(parent) === void 0) throw new SessionNotFoundError(`"${chat}" and "${parent}" are not both chats of stories`);
|
|
5725
|
+
const timelines = deps.timelines;
|
|
5726
|
+
const forked = deps.agentOf(chat);
|
|
5727
|
+
if (timelines === void 0 || forked === void 0) throw new AgentUnavailableError("the branch cannot be made: the orchestration or the chat of the branch is not running");
|
|
5728
|
+
try {
|
|
5729
|
+
await timelines.adopt(chat, parent, atSeq, forked);
|
|
5730
|
+
} catch (error) {
|
|
5731
|
+
if (!(error instanceof AgentUnavailableError)) await deps.discard(chat).catch(() => void 0);
|
|
5732
|
+
throw error;
|
|
5733
|
+
}
|
|
5734
|
+
return { id };
|
|
5735
|
+
}
|
|
5693
5736
|
// src/host/storage/root-path.ts
|
|
5694
5737
|
/** Directories every roleplay root contains. */
|
|
5695
5738
|
const ROOT_LAYOUT = [
|
|
@@ -10052,7 +10095,9 @@ function apply(ctx, config) {
|
|
|
10052
10095
|
speech: {
|
|
10053
10096
|
voices: async () => await voicesOf(textToSpeechOf(ctx)),
|
|
10054
10097
|
speak: async (parts) => await speakParts(textToSpeechOf(ctx), parts),
|
|
10055
|
-
streaming: () => streamingSpeechToTextOf(ctx) !== void 0
|
|
10098
|
+
streaming: () => streamingSpeechToTextOf(ctx) !== void 0,
|
|
10099
|
+
synthesis: () => ctx.get("textToSpeech") !== void 0,
|
|
10100
|
+
images: () => ctx.get("imageGeneration") !== void 0
|
|
10056
10101
|
},
|
|
10057
10102
|
worlds,
|
|
10058
10103
|
createWorld: (input) => createWorld(worlds, input),
|
|
@@ -10338,6 +10383,13 @@ function apply(ctx, config) {
|
|
|
10338
10383
|
readSettings: (id) => readChatSettings(settingsDeps, id),
|
|
10339
10384
|
writeSettings: (id, value) => writeChatSettings(settingsDeps, id, value),
|
|
10340
10385
|
timeline: (id) => timelinesOf(ctx, deps.sessionsDir, id).view(id),
|
|
10386
|
+
branch: async (chat, parent, atSeq) => {
|
|
10387
|
+
return await branchSession({
|
|
10388
|
+
timelines: ctx.roleplayOrchestration.timelines,
|
|
10389
|
+
agentOf: (chat) => ctx.get("agents")?.get(SessionId(chat)),
|
|
10390
|
+
discard: purgeChat
|
|
10391
|
+
}, chat, parent, atSeq);
|
|
10392
|
+
},
|
|
10341
10393
|
moveTimeline: (id, to) => timelinesOf(ctx, deps.sessionsDir, id).move(chatSessionId(id), to === "start" ? null : to),
|
|
10342
10394
|
markCheckpoint: (id, turn, label, note) => label.trim() === "" ? timelinesOf(ctx, deps.sessionsDir, id).unmark(chatSessionId(id), turn) : timelinesOf(ctx, deps.sessionsDir, id).mark(chatSessionId(id), turn, label, note),
|
|
10343
10395
|
statistics: (id) => statisticsOfSession({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as roleplaySessionOf } from "./child-
|
|
1
|
+
import { j as roleplaySessionOf } from "./child-Bfj7-Iuo.js";
|
|
2
2
|
import { i as isInside } from "./service-mRKwpWjX.js";
|
|
3
3
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
4
|
import { readdirSync, realpathSync, statSync } from "node:fs";
|
|
@@ -104,4 +104,4 @@ function registerFoldersJail(ctx, deps) {
|
|
|
104
104
|
}
|
|
105
105
|
export { registerFoldersJail as t };
|
|
106
106
|
|
|
107
|
-
//# sourceMappingURL=jail-
|
|
107
|
+
//# sourceMappingURL=jail-D83JnxKg.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as atomicWrite } from "./access-
|
|
2
|
-
import { i as translator, n as withoutExtension, r as languageOf, t as trimCharacters } from "./text-
|
|
1
|
+
import { n as atomicWrite } from "./access-5vtPAT3O.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-
|
|
377
|
+
//# sourceMappingURL=library-CnWOHwQl.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./access-
|
|
2
|
-
import { Wt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-
|
|
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-
|
|
4
|
-
import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-
|
|
5
|
-
import { i as translator, r as languageOf } from "./text-
|
|
6
|
-
import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-
|
|
1
|
+
import "./access-5vtPAT3O.js";
|
|
2
|
+
import { Wt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BpkpGMSO.js";
|
|
3
|
+
import { Et as IMPORT_FOLDER, St as cleanText, Tt as withPlayer, U as createPresetFromGuidance, _t as updateLorebookInfo, dn as LORE_SCOPES, ht as readLorebook$1, lt as deleteLorebookEntry, mt as lorebookDirectory, pt as loadLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf } from "./serial-DnVqMDe5.js";
|
|
4
|
+
import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-P_--KSFl.js";
|
|
5
|
+
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-CnWOHwQl.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
@@ -709,4 +709,4 @@ async function lorebookApproval(exec, next, state) {
|
|
|
709
709
|
}
|
|
710
710
|
export { lorebookImportMessage as a, readLorebook as c, lorebookOfChat as d, lorebookAuthorTools as i, selectEntries as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, previewLorebook as s, LOREBOOK_UPLOAD as t, lorebookChatSessionId as u };
|
|
711
711
|
|
|
712
|
-
//# sourceMappingURL=lorebook-author-tools-
|
|
712
|
+
//# sourceMappingURL=lorebook-author-tools-CWZ6WRN-.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-BpkpGMSO.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-D4YHE00t.js";
|
|
3
3
|
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
4
|
-
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-
|
|
5
|
-
import "./hooks-
|
|
6
|
-
import { mt as lorebookDirectory } from "./serial-
|
|
4
|
+
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-CWZ6WRN-.js";
|
|
5
|
+
import "./hooks-P_--KSFl.js";
|
|
6
|
+
import { mt as lorebookDirectory } from "./serial-DnVqMDe5.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readdirSync } from "node:fs";
|
|
9
9
|
// src/lorebook-authoring.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as atomicWriteSync } from "./access-
|
|
1
|
+
import { i as atomicWriteSync } from "./access-5vtPAT3O.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
4
4
|
// ../dsh-roleplay-model/src/clock.ts
|
|
@@ -485,4 +485,4 @@ function decodeOutput(text) {
|
|
|
485
485
|
}
|
|
486
486
|
export { emptyStats as _, liveSettings as a, writeSettings as c, parseSettings as d, parseSwitchboard as f, GATE_SITES as g, DECISION_SITES as h, InvalidSettingsError as i, DEFAULT_SETTINGS as l, rulesOf as m, encodeOutput as n, readSettings as o, WORLD_RULES_KEY as p, encodePreview as r, useChildReasoning as s, decodeOutput as t, SETTINGS_SPEC as u };
|
|
487
487
|
|
|
488
|
-
//# sourceMappingURL=narration
|
|
488
|
+
//# sourceMappingURL=narration-DAHmte8p.js.map
|
package/lib/orchestration.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
|
-
import { t as promptFor } from "./access-
|
|
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-
|
|
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-
|
|
5
|
-
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-
|
|
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-
|
|
7
|
-
import { i as translator, r as languageOf$1 } from "./text-
|
|
8
|
-
import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration
|
|
9
|
-
import { t as registerFoldersJail } from "./jail-
|
|
1
|
+
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
|
+
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
3
|
+
import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-P_--KSFl.js";
|
|
4
|
+
import { A as chatSessionId, O as estimateAnswer, T as currentTurn, a as childTrace, d as sessionOfChat, f as tracerOf, j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces } from "./child-Bfj7-Iuo.js";
|
|
5
|
+
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-2uzE3U-v.js";
|
|
6
|
+
import { A as routeVerdicts, E as askYesNo, O as modeFor, T as announceProblem, Wt as splitPanels, j as yesAt, k as noAt, ln as guarded, mn as INTENT_STATUSES, n as STANDING_PROMPT } from "./serial-DnVqMDe5.js";
|
|
7
|
+
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-DAHmte8p.js";
|
|
9
|
+
import { t as registerFoldersJail } from "./jail-D83JnxKg.js";
|
|
10
10
|
import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
|
|
11
|
-
import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-
|
|
12
|
-
import { _ as API_PREFIX } from "./packs-
|
|
13
|
-
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-
|
|
14
|
-
import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-
|
|
11
|
+
import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CnWOHwQl.js";
|
|
12
|
+
import { _ as API_PREFIX } from "./packs-D9_N8kDF.js";
|
|
13
|
+
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-D0h0X7Jy.js";
|
|
14
|
+
import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-BTpJxmGi.js";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, seededRoll, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
|
|
17
17
|
import { existsSync } from "node:fs";
|
|
@@ -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
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
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
|
|
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 = {
|