@dsh-agentic-roleplay/core 0.12.1 → 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/cordis.patch.yml +108 -0
- package/lib/{access-DifaiHrI.js → access-Csp80TFX.js} +2 -2
- package/lib/{authoring-tools-VOaXzr_R.js → authoring-tools-hacA5fG-.js} +1910 -1853
- package/lib/authoring.js +42 -34
- package/lib/{child-DzZ-aI6k.js → child-DTdY14S9.js} +45 -6
- package/lib/client.js +830 -571
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/{dev-context-Bdm-eVer.js → dev-context-Cgv_wZbG.js} +12 -2
- package/lib/doctor.js +5 -4
- package/lib/{gallery-Ctz-UoFk.js → gallery-BNg0rPTp.js} +3 -3
- package/lib/{generator-Cv6WWmZT.js → generator-9-5at9cZ.js} +2 -2
- package/lib/helper.js +4 -10
- package/lib/{hooks-BdR3mBeM.js → hooks-DlrFO4aQ.js} +216 -45
- package/lib/images.js +4 -4
- package/lib/index.js +67 -45
- package/lib/{jail-Cp4zEfip.js → jail-DVbPSC0R.js} +2 -2
- package/lib/{library-BU2A_Dx8.js → library-DTxakw0z.js} +2 -2
- package/lib/{lorebook-author-tools-DUKcQu8P.js → lorebook-author-tools-dupq-kb_.js} +6 -6
- package/lib/lorebook-authoring.js +7 -6
- package/lib/{narration-CDsJ5wxH.js → narration--K2XVIHI.js} +2 -2
- package/lib/orchestration.js +12 -12
- package/lib/{pack-jail-CzHQu0n3.js → pack-jail-Bq0fzKi4.js} +43 -16
- package/lib/{packs-BZ-45J4-.js → packs-D-7EU3yU.js} +2 -2
- package/lib/{presenter-agent-C2ZkoxZu.js → presenter-agent-vFOxIuWv.js} +6 -6
- package/lib/{preset-BPnRPW-1.js → preset-RHcOG55T.js} +4 -4
- package/lib/{preset-author-tools-DBqPwn-o.js → preset-author-tools-Dwxnpv6V.js} +6 -6
- package/lib/preset-authoring.js +7 -6
- package/lib/{reflection-Cuy0YLv0.js → reflection-DibpEUQK.js} +7 -7
- package/lib/{serial-BZNeK57v.js → serial-CDGoXYh-.js} +1317 -1276
- package/lib/{turn-guard-xaFxYc1T.js → turn-guard-DDxikrq7.js} +3 -3
- package/package.json +4 -3
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 {
|
|
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 { A as plotProgressOf, B as parsePlotsFile, C as readNotes, G as readDocument, H as COMMANDS_KEY, J as errorMessage, L as readUsage, Q as
|
|
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 { $ as deleteWorldPrompt,
|
|
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-
|
|
1
|
+
import { A as chatSessionId, _ as RECOVERY_SHRINK, g as RECOVERY_FLOOR, h as sharedSamplingOf, i as childSamplingOf, j as roleplaySessionOf, m as parseSampling, s as isUnfinishedCall, w as totalTokens } from "./child-DTdY14S9.js";
|
|
2
|
+
import { $ as checkWorld, 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
|
+
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, 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
|
+
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-
|
|
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-
|
|
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
|
+
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-
|
|
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-D-7EU3yU.js";
|
|
17
|
+
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-9-5at9cZ.js";
|
|
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";
|
|
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";
|
|
@@ -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
|
-
/**
|
|
417
|
-
function
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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
|
} },
|
|
@@ -3361,7 +3364,11 @@ function worldsRoutes({ worlds, createWorld, starter, authorWorld, sayToAuthor,
|
|
|
3361
3364
|
} },
|
|
3362
3365
|
"/worlds/language": { GET: async (_req, res, url) => {
|
|
3363
3366
|
try {
|
|
3364
|
-
|
|
3367
|
+
const id = url.searchParams.get("id") ?? "";
|
|
3368
|
+
sendJson(res, 200, {
|
|
3369
|
+
language: await translation.language(id) ?? null,
|
|
3370
|
+
declared: await translation.declared(id) ?? null
|
|
3371
|
+
});
|
|
3365
3372
|
} catch (error) {
|
|
3366
3373
|
if (error instanceof WorldNotFoundError) return sendError(res, 404, error.message);
|
|
3367
3374
|
throw error;
|
|
@@ -5097,6 +5104,7 @@ function sessionsRoutes({ sessions, externalTools, redundantLayers }) {
|
|
|
5097
5104
|
if (error instanceof SessionNotFoundError) return sendError(res, 404, error.message);
|
|
5098
5105
|
if (error instanceof SessionArchivedError) return sendError(res, 409, error.message);
|
|
5099
5106
|
if (error instanceof AgentUnavailableError) return sendError(res, 503, error.message);
|
|
5107
|
+
if (error instanceof CommandRefusedError) return sendError(res, 422, error.message);
|
|
5100
5108
|
throw error;
|
|
5101
5109
|
}
|
|
5102
5110
|
} },
|
|
@@ -5831,12 +5839,8 @@ function purgeDepsOf(ctx, storePath) {
|
|
|
5831
5839
|
const purgeOf = (ctx, storePath) => (chat) => purgeChat(purgeDepsOf(ctx, storePath), chat);
|
|
5832
5840
|
// src/host/setup/rows.ts
|
|
5833
5841
|
const ALL = ["@dsh-agentic-roleplay/all", "dsh-agentic-roleplay"];
|
|
5834
|
-
const
|
|
5835
|
-
|
|
5836
|
-
"@dsh-agentic-roleplay/state",
|
|
5837
|
-
"dsh-agentic-roleplay-core",
|
|
5838
|
-
"dsh-roleplay-state"
|
|
5839
|
-
];
|
|
5842
|
+
const CORE = ["@dsh-agentic-roleplay/core", "dsh-agentic-roleplay-core"];
|
|
5843
|
+
const STATE = ["@dsh-agentic-roleplay/state", "dsh-roleplay-state"];
|
|
5840
5844
|
/**
|
|
5841
5845
|
* The profile directory DSH launched this plugin in: `DSH_PROFILE_DIR`, which a profile-launched Host carries, or
|
|
5842
5846
|
* `DSH_HOME/profiles/<DSH_PROFILE>` when only those are set (a `dsh` CLI launch). Both are environment facts; a
|
|
@@ -5861,15 +5865,13 @@ function selectedBundles(profileDir) {
|
|
|
5861
5865
|
return [];
|
|
5862
5866
|
}
|
|
5863
5867
|
}
|
|
5864
|
-
/**
|
|
5865
|
-
* The layers of single packages that are selected next to the `all` layer. Each of them inserts the same plugin row as `all`, so the profile then holds the row twice
|
|
5866
|
-
* and DSH, which writes a plugin's settings through its row, refuses every save of Settings → Role Play.
|
|
5867
|
-
*/
|
|
5868
|
+
/** Layers made redundant by a selected complete install. Duplicate rows prevent DSH from saving their settings. */
|
|
5868
5869
|
function redundantLayers(bundles) {
|
|
5869
|
-
|
|
5870
|
+
if (bundles.some((name) => ALL.includes(name))) return bundles.filter((name) => CORE.includes(name) || STATE.includes(name));
|
|
5871
|
+
return bundles.some((name) => CORE.includes(name)) ? bundles.filter((name) => STATE.includes(name)) : [];
|
|
5870
5872
|
}
|
|
5871
5873
|
function redundantLayersMessage(layers) {
|
|
5872
|
-
return `the profile selects ${layers.map((name) => `"${name}"`).join(", ")} next to
|
|
5874
|
+
return `the profile selects ${layers.map((name) => `"${name}"`).join(", ")} next to a layer that already inserts the same plugin rows (the all bundle, or the core package, which includes the state plugin), so DSH refuses to save the Role Play settings: deselect them (keep the packages installed) and restart`;
|
|
5873
5875
|
}
|
|
5874
5876
|
// src/host/worlds/lore-entries.ts
|
|
5875
5877
|
const MAX_TITLE = 200;
|
|
@@ -6885,6 +6887,13 @@ async function startSession(deps, request) {
|
|
|
6885
6887
|
mode: answers.clockMode
|
|
6886
6888
|
}
|
|
6887
6889
|
};
|
|
6890
|
+
if (world.language !== void 0 && (request.settings?.prompts)?.language === void 0) settings = {
|
|
6891
|
+
...settings,
|
|
6892
|
+
prompts: {
|
|
6893
|
+
...settings.prompts,
|
|
6894
|
+
language: world.language
|
|
6895
|
+
}
|
|
6896
|
+
};
|
|
6888
6897
|
const givenAutonomy = (request.settings?.autonomy)?.enabled;
|
|
6889
6898
|
if (world.autonomy === true && givenAutonomy === void 0) settings = {
|
|
6890
6899
|
...settings,
|
|
@@ -7680,6 +7689,7 @@ async function loadWorld(folder, dir, file, problems) {
|
|
|
7680
7689
|
...world.autonomy === void 0 ? {} : { autonomy: world.autonomy },
|
|
7681
7690
|
...world.narrationVoice === void 0 ? {} : { narrationVoice: world.narrationVoice },
|
|
7682
7691
|
...world.sampling === void 0 ? {} : { sampling: world.sampling },
|
|
7692
|
+
...world.language === void 0 ? {} : { language: world.language },
|
|
7683
7693
|
...world.preset === void 0 ? {} : { preset: world.preset },
|
|
7684
7694
|
...world.lorebooks === void 0 ? {} : { lorebooks: world.lorebooks }
|
|
7685
7695
|
};
|
|
@@ -9821,7 +9831,14 @@ function apply(ctx, config) {
|
|
|
9821
9831
|
if (timer !== void 0) clearTimeout(timer);
|
|
9822
9832
|
};
|
|
9823
9833
|
}, "roleplay: stories that go on while the player is away");
|
|
9824
|
-
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));
|
|
9825
9842
|
const presetAuthoring = new PresetAuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages);
|
|
9826
9843
|
const lorebookAuthoring = new LorebookAuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages);
|
|
9827
9844
|
const doctors = new DoctorSessions(agentServicesOf(ctx), () => root.path, prompts);
|
|
@@ -10059,6 +10076,11 @@ function apply(ctx, config) {
|
|
|
10059
10076
|
},
|
|
10060
10077
|
translation: {
|
|
10061
10078
|
language: (id) => worldLanguage(worlds, id),
|
|
10079
|
+
declared: async (id) => {
|
|
10080
|
+
const record = await worlds.find(id);
|
|
10081
|
+
if (record === void 0) throw new WorldNotFoundError(`there is no world with id "${id}"`);
|
|
10082
|
+
return record.language;
|
|
10083
|
+
},
|
|
10062
10084
|
start: (id, to, title, language) => startTranslation({
|
|
10063
10085
|
worlds,
|
|
10064
10086
|
authoring,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as roleplaySessionOf } from "./child-
|
|
1
|
+
import { j as roleplaySessionOf } from "./child-DTdY14S9.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-DVbPSC0R.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as atomicWrite } from "./access-
|
|
1
|
+
import { n as atomicWrite } from "./access-Csp80TFX.js";
|
|
2
2
|
import { i as translator, n as withoutExtension, r as languageOf, t as trimCharacters } from "./text-Dfv8S8eq.js";
|
|
3
3
|
import { dirname, extname, join } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
@@ -374,4 +374,4 @@ async function addToLibrary(sessionFolder, bytes, originalName) {
|
|
|
374
374
|
}
|
|
375
375
|
export { slug as C, norm as S, uniqueKey as T, writeImageFileMetadata as _, LIBRARY_FOLDER as a, NoEmbeddingService as b, nextSceneSerial as c, sceneImagePath as d, writeImage as f, sidecarOf as g, readImageFileMetadata as h, libraryHashes as i, readImageMetadata as l, mediaTypeOf as m, addToLibraryOnce as n, entityImageDirectory as o, MEDIA_TYPES as p, imageExtensionOf as r, inheritImages as s, addToLibrary as t, referenceImagePath as u, readPngMetadata as v, trOf as w, mapLimit as x, withPngMetadata as y };
|
|
376
376
|
|
|
377
|
-
//# sourceMappingURL=library-
|
|
377
|
+
//# sourceMappingURL=library-DTxakw0z.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./access-
|
|
2
|
-
import {
|
|
3
|
-
import { B as createPresetFromGuidance,
|
|
4
|
-
import { F as textLanguage, I as wrongLanguage,
|
|
1
|
+
import "./access-Csp80TFX.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
|
-
import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-
|
|
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";
|
|
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-dupq-kb_.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { t as silenceHarnessDevContext } from "./dev-context-
|
|
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 { dt as lorebookDirectory } from "./serial-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-hacA5fG-.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-DDxikrq7.js";
|
|
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-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
|
|
@@ -20,6 +20,7 @@ const inject = [
|
|
|
20
20
|
/** The lorebook authoring chat: reads and writes the entries of one library lorebook, each write approved by the person. */
|
|
21
21
|
function apply(ctx) {
|
|
22
22
|
silenceHarnessDevContext(ctx);
|
|
23
|
+
silenceRuntimeContext(ctx);
|
|
23
24
|
const library = () => ctx.roleplayRoot.path;
|
|
24
25
|
const reader = new LorebookReader(library);
|
|
25
26
|
const prompting = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as atomicWriteSync } from "./access-
|
|
1
|
+
import { i as atomicWriteSync } from "./access-Csp80TFX.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--K2XVIHI.js.map
|
package/lib/orchestration.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as silenceHarnessDevContext } from "./dev-context-
|
|
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,
|
|
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,
|
|
1
|
+
import { t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
|
+
import { t as promptFor } from "./access-Csp80TFX.js";
|
|
3
|
+
import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-DlrFO4aQ.js";
|
|
4
|
+
import { A as chatSessionId, O as estimateAnswer, T as currentTurn, a as childTrace, d as sessionOfChat, f as tracerOf, j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces } from "./child-DTdY14S9.js";
|
|
5
|
+
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-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
|
-
import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration
|
|
9
|
-
import { t as registerFoldersJail } from "./jail-
|
|
8
|
+
import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration--K2XVIHI.js";
|
|
9
|
+
import { t as registerFoldersJail } from "./jail-DVbPSC0R.js";
|
|
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-DTxakw0z.js";
|
|
12
|
+
import { _ as API_PREFIX } from "./packs-D-7EU3yU.js";
|
|
13
|
+
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-BNg0rPTp.js";
|
|
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";
|
|
16
16
|
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, seededRoll, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
|
|
17
17
|
import { existsSync } from "node:fs";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as chatSessionId } from "./child-
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
4
|
-
import { n as encodeOutput } from "./narration
|
|
5
|
-
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-
|
|
6
|
-
import { B as parsePlotsFile, F as textLanguage, K as Reader, M as LANGUAGE_NAMES, N as STORY_LANGUAGES, P as isStoryLanguage, R as PLOTS_FILE_NAME, V as plotReferenceProblems,
|
|
1
|
+
import { A as chatSessionId } from "./child-DTdY14S9.js";
|
|
2
|
+
import { A as loadWorldParts, At as UPDATE_FOLDER, Bt as TRIGGERS_FILE_NAME, Ct as loadDice, D as worldFieldChanges, Dt as parseCalendarFile, Et as loadCalendar, F as editsSince, G as addressesToFetch, I as writeSnapshot, It as COMMANDS_FILE_NAME, Jt as DICE_READINGS, K as candidateUrls, Lt as commandVariable, Mt as cardPieces, O as editWorldInfo, Ot as CHARACTERS_DIR, P as recordProvenance, Q as writePortrait, Rt as loadCommands, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, Vt as loadTriggers, W as addressKey, Xt as authoredWorldOf, Y as mergeReports, Yt as DICE_RESULTS, Z as cardCharacter, Zt as authoringChatSessionId, _t as loadLocations, bt as FACTIONS_DIR, et as loadValidatedWorld, f as importPhase, gt as LOCATIONS_DIR, ht as routineProblems, jt as baseId, kt as loadCharacters, nt as knowsCharacter, o as contextOf, q as fetchPictures, qt as DICE_COMPARISONS, tt as withScratchStory, u as worldOf, vt as ITEMS_DIR, wt as parseDiceFile, xt as loadFactions, yt as loadItems, zt as parseCommandsFile } from "./authoring-tools-hacA5fG-.js";
|
|
3
|
+
import { At as writeChoices, Ct as IMPORT_FOLDER, Et as PICTURE_FILE, Gt as loadVariables, Jt as LORE_FILE_NAME, Kt as parseVariablesFile, M as WORLD_FILE_NAME, N as parseWorldFile, Qt as ITEM_FILE_NAME, St as withPlayer, Wt as VARIABLES_FILE_NAME, Xt as LOCATION_FILE_NAME, Yt as parseLoreFile, Zt as parseLocationFile, _t as loadLore, an as parseCharacterFile, en as parseItemFile, gt as LORE_DIR, in as CHARACTER_FILE_NAME, jt as InvalidEditProblems, kt as readImportFolder, l as extractStyleFrom, nn as FACTION_FILE_NAME, nt as writeWorldPrompt, qt as variableProblems, rn as parseFactionFile, vt as subfolders } from "./serial-CDGoXYh-.js";
|
|
4
|
+
import { n as encodeOutput } from "./narration--K2XVIHI.js";
|
|
5
|
+
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-Csp80TFX.js";
|
|
6
|
+
import { B as parsePlotsFile, F as textLanguage, K as Reader, M as LANGUAGE_NAMES, N as STORY_LANGUAGES, P as isStoryLanguage, R as PLOTS_FILE_NAME, V as plotReferenceProblems, Z as PROMPTS_FOLDER, gt as runCommandLine, it as shippedLanguages, lt as InvalidWorldError, mt as CommandRefusedError, pt as WorldNotFoundError, q as formatIssue, st as AgentUnavailableError, z as loadPlots } from "./hooks-DlrFO4aQ.js";
|
|
7
7
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
8
|
-
import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-
|
|
9
|
-
import { n as readPreset } from "./preset-
|
|
10
|
-
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-
|
|
11
|
-
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-
|
|
8
|
+
import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-DTxakw0z.js";
|
|
9
|
+
import { n as readPreset } from "./preset-RHcOG55T.js";
|
|
10
|
+
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-D-7EU3yU.js";
|
|
11
|
+
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-9-5at9cZ.js";
|
|
12
12
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
13
13
|
import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
|
|
14
14
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
@@ -256,11 +256,16 @@ function agentServicesOf(ctx) {
|
|
|
256
256
|
if (controller === void 0 || registry === void 0) throw new AgentUnavailableError("this DSH profile has no session services, so a roleplay chat cannot be opened");
|
|
257
257
|
const persistence = ctx.get("sessionPersistence");
|
|
258
258
|
const agents = ctx.get("agents");
|
|
259
|
+
const command = agents === void 0 ? void 0 : async (chat, line) => {
|
|
260
|
+
const live = agents.get(chat);
|
|
261
|
+
return live === void 0 ? void 0 : await runCommandLine(ctx, live, line, new AbortController().signal);
|
|
262
|
+
};
|
|
259
263
|
return {
|
|
260
264
|
controller,
|
|
261
265
|
registry,
|
|
262
266
|
...persistence === void 0 ? {} : { persistence },
|
|
263
|
-
...agents === void 0 ? {} : { unload: unloader(ctx, agents) }
|
|
267
|
+
...agents === void 0 ? {} : { unload: unloader(ctx, agents) },
|
|
268
|
+
...command === void 0 ? {} : { command }
|
|
264
269
|
};
|
|
265
270
|
};
|
|
266
271
|
}
|
|
@@ -373,9 +378,16 @@ var AgentSessions = class {
|
|
|
373
378
|
}
|
|
374
379
|
/** Says something in the chat of a session as the player would; it is queued behind what the chat is doing. The chat must exist (`ensure`). */
|
|
375
380
|
async send(sessionId, text) {
|
|
376
|
-
|
|
381
|
+
const services = this.services();
|
|
382
|
+
const chat = chatSessionId(sessionId);
|
|
383
|
+
const ran = text.startsWith("/") ? await services.command?.(chat, text) : void 0;
|
|
384
|
+
if (ran !== void 0) {
|
|
385
|
+
if (ran.kind === "error") throw new CommandRefusedError(ran.text);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
await services.controller.prompt({
|
|
377
389
|
requestId: randomUUID(),
|
|
378
|
-
sessionId:
|
|
390
|
+
sessionId: chat,
|
|
379
391
|
mode: "queue",
|
|
380
392
|
content: [{
|
|
381
393
|
type: "text",
|
|
@@ -460,11 +472,13 @@ var AuthoringSessions = class {
|
|
|
460
472
|
roleplayRoot;
|
|
461
473
|
prompts;
|
|
462
474
|
languages;
|
|
463
|
-
|
|
475
|
+
beginImport;
|
|
476
|
+
constructor(services, roleplayRoot, prompts, languages, beginImport) {
|
|
464
477
|
this.services = services;
|
|
465
478
|
this.roleplayRoot = roleplayRoot;
|
|
466
479
|
this.prompts = prompts;
|
|
467
480
|
this.languages = languages;
|
|
481
|
+
this.beginImport = beginImport;
|
|
468
482
|
}
|
|
469
483
|
async ensure(worldId, worldName, title, language) {
|
|
470
484
|
return await ensureAuthoringChat(this.services(), this.roleplayRoot(), this.prompts, this.languages, KIND, {
|
|
@@ -476,9 +490,22 @@ var AuthoringSessions = class {
|
|
|
476
490
|
renameExisting: true
|
|
477
491
|
});
|
|
478
492
|
}
|
|
493
|
+
/** Has the chat import the card waiting in its world, as the `/import-st` command does. */
|
|
494
|
+
async startImport(sessionId, request) {
|
|
495
|
+
if (this.beginImport === void 0) throw new Error("imports cannot be started here");
|
|
496
|
+
const begun = await this.beginImport(sessionId, request);
|
|
497
|
+
if (!begun.ok) throw new Error(begun.reason);
|
|
498
|
+
await this.send(sessionId, begun.message);
|
|
499
|
+
}
|
|
479
500
|
/** Sends a message into a chat as if the person had written it. */
|
|
480
501
|
async send(sessionId, text) {
|
|
481
|
-
|
|
502
|
+
const services = this.services();
|
|
503
|
+
const ran = text.startsWith("/") ? await services.command?.(sessionId, text) : void 0;
|
|
504
|
+
if (ran !== void 0) {
|
|
505
|
+
if (ran.kind === "error") throw new CommandRefusedError(ran.text);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
await services.controller.prompt({
|
|
482
509
|
requestId: randomUUID(),
|
|
483
510
|
sessionId,
|
|
484
511
|
mode: "queue",
|
|
@@ -3199,4 +3226,4 @@ function registerPackJail(ctx, deps) {
|
|
|
3199
3226
|
}
|
|
3200
3227
|
export { languageOfDocuments as $, generateWorldCharacterPortrait as A, deleteTriggerDocument as B, editWorldFaction as C, editWorldPlots as D, editWorldPlace as E, uploadWorldCharacterPortrait as F, parseVariablesEdit as G, writeTriggerDocument as H, uploadWorldEntityImage as I, PRESET_FILE as J, parseDiceEdit as K, worldCharacterPortraitFile as L, readWorldEditor as M, readWorldTrigger as N, editWorldRelation as O, removeWorldTrigger as P, translateTools as Q, worldEntityImageFile as R, editWorldCharacter as S, editWorldNarrationVoice as T, parseCalendarEdit as U, readTriggerDocuments as V, parseRoutineEdit as W, presetTools as X, presetMessage as Y, translateMessage as Z, readCalendarDocument as _, deleteWorldPackFile as a, startUpdate as at, readRoutines as b, createAuthoredEntity as c, authoringTitle as ct, replaceAuthoredEntity as d, agentServicesOf as dt, readWorldDocuments as et, editCalendar as f, DOCTOR_OPENING_SOURCE as ft, editVariables as g, editRoutine as h, checkWorldPack as i, revertUpdate as it, generateWorldEntityImage as j, editWorldThing as k, deleteAuthoredEntity as l, ensureAuthoringChat as lt, editDice as m, appendNarratedTurn as mt, packFileProblem as n, finishUpdate as nt, listWorldPacks as o, updateStatus as ot, editCommands as p, appendEmptyTurn as pt, parseCommandsEdit as q, registerPackJail as r, pendingUpdate as rt, AUTHORED_ENTITY_KINDS as s, AuthoringSessions as st, MAX_PACK_TEXT as t, findTargets as tt, readAuthoredEntityDocument as u, AgentSessions as ut, readCommandsDocument as v, editWorldLore as w, readVariables as x, readDiceDocument as y, writeWorldTrigger as z };
|
|
3201
3228
|
|
|
3202
|
-
//# sourceMappingURL=pack-jail-
|
|
3229
|
+
//# sourceMappingURL=pack-jail-Bq0fzKi4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as Reader } from "./hooks-
|
|
1
|
+
import { K as Reader } from "./hooks-DlrFO4aQ.js";
|
|
2
2
|
import { dirname, extname, join, posix, sep } from "node:path";
|
|
3
3
|
import { copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync } from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -836,4 +836,4 @@ function anyTab(bases) {
|
|
|
836
836
|
}
|
|
837
837
|
export { API_PREFIX as _, packIds as a, describePack as c, packPath as d, readPack as f, SURFACE_NAMES as g, PACK_MEDIA_TYPES as h, inheritPacks as i, isPackId as l, PACK_LIMITS as m, anyTab as n, syncWorldPacks as o, PACK_ACTIONS as p, copyWorldPacks as r, worldPackStates as s, activePack as t, packFile as u };
|
|
838
838
|
|
|
839
|
-
//# sourceMappingURL=packs-
|
|
839
|
+
//# sourceMappingURL=packs-D-7EU3yU.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as atomicWrite, t as promptFor } from "./access-
|
|
2
|
-
import { l as runChild } from "./child-
|
|
3
|
-
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-
|
|
4
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
5
|
-
import { c as nextSceneSerial, u as referenceImagePath } from "./library-
|
|
1
|
+
import { n as atomicWrite, t as promptFor } from "./access-Csp80TFX.js";
|
|
2
|
+
import { l as runChild } from "./child-DTdY14S9.js";
|
|
3
|
+
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-9-5at9cZ.js";
|
|
4
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BNg0rPTp.js";
|
|
5
|
+
import { c as nextSceneSerial, u as referenceImagePath } from "./library-DTxakw0z.js";
|
|
6
6
|
import { join, relative, sep } from "node:path";
|
|
7
7
|
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -844,4 +844,4 @@ async function runImagePresenter(job) {
|
|
|
844
844
|
}
|
|
845
845
|
export { searchImages as a, presentedFor as c, findImages as i, interpretImage as n, tokensOf as o, imageTools as r, present as s, runImagePresenter as t };
|
|
846
846
|
|
|
847
|
-
//# sourceMappingURL=presenter-agent-
|
|
847
|
+
//# sourceMappingURL=presenter-agent-vFOxIuWv.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p as SAMPLING_RANGES } from "./child-
|
|
3
|
-
import {
|
|
1
|
+
import { Ht as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-hacA5fG-.js";
|
|
2
|
+
import { p as SAMPLING_RANGES } from "./child-DTdY14S9.js";
|
|
3
|
+
import { yt as cleanText } from "./serial-CDGoXYh-.js";
|
|
4
4
|
// src/host/import/preset.ts
|
|
5
5
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
6
6
|
const LEGACY_KEYS = [
|
|
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
239
239
|
}
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-RHcOG55T.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./access-
|
|
2
|
-
import { $ as deleteWorldPrompt, K as presetDirectory, Q as PROSE_PROMPTS,
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import {
|
|
1
|
+
import "./access-Csp80TFX.js";
|
|
2
|
+
import { $ as deleteWorldPrompt, Ct as IMPORT_FOLDER, K as presetDirectory, Q as PROSE_PROMPTS, St as withPlayer, Z as updatePresetInfo, et as listWorldPrompts, l as extractStyleFrom, nt as writeWorldPrompt, q as readPreset, tt as readWorldPrompt, z as PRESET_FILE } from "./serial-CDGoXYh-.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-RHcOG55T.js";
|
|
4
|
+
import { o as contextOf } from "./authoring-tools-hacA5fG-.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import {
|
|
6
|
+
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-DlrFO4aQ.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -279,4 +279,4 @@ async function presetApproval(exec, next, carries, auto = () => false) {
|
|
|
279
279
|
}
|
|
280
280
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
281
281
|
|
|
282
|
-
//# sourceMappingURL=preset-author-tools-
|
|
282
|
+
//# sourceMappingURL=preset-author-tools-Dwxnpv6V.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { t as silenceHarnessDevContext } from "./dev-context-
|
|
4
|
-
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-
|
|
5
|
-
import "./hooks-
|
|
6
|
-
import { K as presetDirectory } from "./serial-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-hacA5fG-.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-DDxikrq7.js";
|
|
3
|
+
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-Dwxnpv6V.js";
|
|
5
|
+
import "./hooks-DlrFO4aQ.js";
|
|
6
|
+
import { K as presetDirectory } from "./serial-CDGoXYh-.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
// src/preset-authoring.ts
|
|
@@ -20,6 +20,7 @@ const inject = [
|
|
|
20
20
|
/** The preset authoring chat: reads and writes the prose prompts of one library preset, each write approved by the person. */
|
|
21
21
|
function apply(ctx) {
|
|
22
22
|
silenceHarnessDevContext(ctx);
|
|
23
|
+
silenceRuntimeContext(ctx);
|
|
23
24
|
const library = () => ctx.roleplayRoot.path;
|
|
24
25
|
const reader = new PresetReader(library);
|
|
25
26
|
const prompting = {
|