@dsh-agentic-roleplay/core 0.7.3 → 0.8.2
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/README.md +1 -1
- package/lib/{access-DtOxFKBK.js → access-CfQWbNZP.js} +4 -7
- package/lib/authoring-tools-BgmC2oqU.js +3691 -0
- package/lib/authoring.js +59 -24
- package/lib/{child-CyCViUKa.js → child-lYYeOwl2.js} +147 -46
- package/lib/client.js +931 -860
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +8 -13
- package/lib/{doctor-chat-ByDfCMeo.js → doctor-chat-hL1a61hp.js} +2 -3
- package/lib/doctor.js +6 -8
- package/lib/{gallery-DmBZ2L5l.js → gallery-D1V4h8vh.js} +3 -4
- package/lib/{generator-BmdoTIL2.js → generator-CLPosooC.js} +3 -4
- package/lib/helper.js +2 -3
- package/lib/{hooks-C8eELrni.js → hooks-rQTTeOC4.js} +144 -88
- package/lib/images.js +4 -4
- package/lib/index.js +1024 -913
- package/lib/{library-lVNf9qG_.js → library-Dfu0dgRj.js} +32 -21
- package/lib/{lorebook-author-tools-BDOs4i5C.js → lorebook-author-tools-BAaAqZZm.js} +11 -14
- package/lib/lorebook-authoring.js +5 -6
- package/lib/{narration-DvFBqmqe.js → narration-CjB_KwwY.js} +58 -20
- package/lib/orchestration.js +138 -72
- package/lib/{pack-jail-DeTscGT2.js → pack-jail-CN-314ln.js} +94 -137
- package/lib/{packs-CY8ms8v_.js → packs-DIj5BEfq.js} +6 -10
- package/lib/{presenter-agent-cFR4sos3.js → presenter-agent-DR0KvLE0.js} +13 -19
- package/lib/{preset-n4-j6k4S.js → preset-CscHj1-Y.js} +5 -5
- package/lib/{preset-author-tools-2m4BLtws.js → preset-author-tools-CxluF8qc.js} +13 -15
- package/lib/preset-authoring.js +6 -7
- package/lib/presets-HB8kJTaE.js +3993 -0
- package/lib/{reflection-CJB5s0ip.js → reflection-Dg1xtOTW.js} +137 -148
- package/lib/{text-Cwl5s0j0.js → text-DyRN4nDP.js} +13 -7
- package/lib/{turn-guard-BvCs1VxB.js → turn-guard-g_hDn0jR.js} +6 -7
- package/package.json +29 -29
- package/prompts/en/import/casting.md +14 -0
- package/prompts/en/import/character.md +1 -0
- package/prompts/en/import/classifier.md +9 -0
- package/prompts/en/import/finish-draft.md +1 -0
- package/prompts/en/import/generator.md +8 -0
- package/prompts/en/import/notice-repair.md +4 -0
- package/prompts/en/import/repair-again.md +3 -0
- package/prompts/en/import/roster.md +1 -0
- package/prompts/en/import/variables.md +1 -0
- package/prompts/en/roleplay/game-master.md +3 -0
- package/prompts/en/roleplay/standing.md +1 -0
- package/prompts/en/world/author.md +1 -1
- package/prompts/zh/import/casting.md +14 -0
- package/prompts/zh/import/character.md +1 -0
- package/prompts/zh/import/classifier.md +9 -0
- package/prompts/zh/import/finish-draft.md +1 -0
- package/prompts/zh/import/generator.md +8 -0
- package/prompts/zh/import/notice-repair.md +4 -0
- package/prompts/zh/import/repair-again.md +3 -0
- package/prompts/zh/import/roster.md +1 -0
- package/prompts/zh/import/variables.md +1 -0
- package/prompts/zh/roleplay/game-master.md +3 -0
- package/prompts/zh/roleplay/standing.md +1 -0
- package/prompts/zh/world/author.md +1 -1
- package/lib/authoring-tools-CIsWbq0B.js +0 -6317
- package/lib/route-C6SHz9j2.js +0 -518
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { a as chatSessionId } from "./access-
|
|
2
|
-
import { $
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { B as loadPlots, F as STORY_LANGUAGES,
|
|
6
|
-
import { i as translator, r as languageOf } from "./text-
|
|
7
|
-
import { u as parseSampling } from "./child-
|
|
8
|
-
import { b as mapLimit, h as readImageFileMetadata, u as referenceImagePath, x as norm } 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-
|
|
1
|
+
import { a as chatSessionId } from "./access-CfQWbNZP.js";
|
|
2
|
+
import { $ as loadValidatedWorld, At as CHARACTERS_DIR, Ct as loadFactions, D as fetchPictures, E as candidateUrls, F as serialized, Ht as authoringChatSessionId, I as WORLD_FILE_NAME, L as parseWorldFile, M as cardCharacter, Mt as subfolders, N as openingMessage, Ot as loadCalendar, P as writePortrait, St as FACTIONS_DIR, T as addressesToFetch, Vt as authoredWorldOf, _t as loadLore, bt as ITEMS_DIR, c as importPhase, ct as populateLocations, et as knowsCharacter, ft as populateVariables, g as writeSnapshot, gt as LORE_DIR, h as editsSince, ht as loadTriggers, i as contextOf, j as alternateOpenings, jt as loadCharacters, k as mergeReports, m as recordProvenance, mt as TRIGGERS_FILE_NAME, nt as populateCharacters, ot as populateItems, s as worldOf, vt as LOCATIONS_DIR, w as addressKey, xt as loadItems, yt as loadLocations } from "./authoring-tools-BgmC2oqU.js";
|
|
3
|
+
import { A as sourcesFor, Ct as parseCharacterFile, Et as InvalidEditProblems, N as findEntity, Q as IMPORT_FOLDER, St as CHARACTER_FILE_NAME, Y as itemise, Z as withPlayer, at as writeChoices, bt as FACTION_FILE_NAME, ft as LORE_FILE_NAME, gt as ITEM_FILE_NAME, ht as parseLocationFile, it as readImportFolder, lt as loadVariables, mt as LOCATION_FILE_NAME, nt as openingText, pt as parseLoreFile, q as writeWorldPrompt, tt as PICTURE_FILE, vt as parseItemFile, x as extractStyleFrom, xt as parseFactionFile } from "./presets-HB8kJTaE.js";
|
|
4
|
+
import { l as atomicWrite, m as parseSwitchboard, n as encodeOutput, u as atomicWriteJson } from "./narration-CjB_KwwY.js";
|
|
5
|
+
import { B as loadPlots, F as STORY_LANGUAGES, H as plotReferenceProblems, I as isStoryLanguage, J as formatIssue, L as textLanguage, P as LANGUAGE_NAMES, V as parsePlotsFile, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, st as AgentUnavailableError, z as PLOTS_FILE_NAME } from "./hooks-rQTTeOC4.js";
|
|
6
|
+
import { i as translator, r as languageOf } from "./text-DyRN4nDP.js";
|
|
7
|
+
import { u as parseSampling } from "./child-lYYeOwl2.js";
|
|
8
|
+
import { b as mapLimit, h as readImageFileMetadata, u as referenceImagePath, x as norm } from "./library-Dfu0dgRj.js";
|
|
9
|
+
import { n as readPreset } from "./preset-CscHj1-Y.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-DIj5BEfq.js";
|
|
11
|
+
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CLPosooC.js";
|
|
12
12
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
13
13
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
|
+
import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
15
16
|
import { Session, SessionId } from "@deepseek-ai/dsh-session";
|
|
16
17
|
import { ToolCallId, createMessage, createSystemMessage, createToolResultMessage } from "@deepseek-ai/dsh-llm";
|
|
17
18
|
import { setApprovalPolicy } from "@deepseek-ai/dsh-user-approval";
|
|
18
19
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
19
|
-
import { chmod, cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
20
20
|
import { createSessionStore, readTriggerDefinition, triggerReferenceProblems, writeCalendar } from "@dsh-agentic-roleplay/state";
|
|
21
|
-
|
|
21
|
+
// src/host/agent/opening.ts
|
|
22
22
|
/** What the opening is reported to come from, where a chat shows the source of a message. */
|
|
23
23
|
const OPENING_SOURCE = {
|
|
24
24
|
provider: "roleplay",
|
|
@@ -195,11 +195,8 @@ function authoringOpeningEvents(welcome, source = AUTHORING_OPENING_SOURCE) {
|
|
|
195
195
|
async function storeOpening(persistence, chat, segments, events = openingEvents(segments)) {
|
|
196
196
|
await storeInitialEvents(persistence, chat, events);
|
|
197
197
|
}
|
|
198
|
-
async function storeAuthoringOpening(persistence, chat, welcome) {
|
|
199
|
-
await storeInitialEvents(persistence, chat, authoringOpeningEvents(welcome));
|
|
200
|
-
}
|
|
201
|
-
async function storeDoctorOpening(persistence, chat, welcome) {
|
|
202
|
-
await storeInitialEvents(persistence, chat, authoringOpeningEvents(welcome, DOCTOR_OPENING_SOURCE));
|
|
198
|
+
async function storeAuthoringOpening(persistence, chat, welcome, source) {
|
|
199
|
+
await storeInitialEvents(persistence, chat, authoringOpeningEvents(welcome, source));
|
|
203
200
|
}
|
|
204
201
|
async function storeInitialEvents(persistence, chat, events) {
|
|
205
202
|
const header = {
|
|
@@ -218,8 +215,7 @@ async function storeInitialEvents(persistence, chat, events) {
|
|
|
218
215
|
await handle.close();
|
|
219
216
|
}
|
|
220
217
|
}
|
|
221
|
-
|
|
222
|
-
//#region src/host/agent/agent-sessions.ts
|
|
218
|
+
// src/host/agent/agent-sessions.ts
|
|
223
219
|
/** Title of the DSH project that groups every roleplay chat. */
|
|
224
220
|
const PROJECT_TITLE = "Roleplay";
|
|
225
221
|
/** The agent preset roleplay chats run under; it is declared by the bundle. */
|
|
@@ -394,10 +390,42 @@ var AgentSessions = class {
|
|
|
394
390
|
}
|
|
395
391
|
}
|
|
396
392
|
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
393
|
+
// src/host/agent/ensure-authoring-chat.ts
|
|
394
|
+
/**
|
|
395
|
+
* Creates or reopens the authoring chat of a subject in the project of its kind: its language is kept, its opening is stored before the chat is made (a stored chat not yet in the project is adopted,
|
|
396
|
+
* not made again), and the chat is made or adopted.
|
|
397
|
+
* @throws {AgentUnavailableError} when the profile cannot store an opening.
|
|
398
|
+
*/
|
|
399
|
+
async function ensureAuthoringChat(services, roleplayRoot, prompts, languages, kind, subject) {
|
|
400
|
+
if (subject.languageKey !== void 0) languages?.set(subject.languageKey, subject.language);
|
|
401
|
+
const language = subject.languageKey === void 0 ? subject.language : languages?.get(subject.languageKey);
|
|
402
|
+
const projectPath = join(roleplayRoot, kind.folder);
|
|
403
|
+
const project = await services.registry.create(projectPath, kind.projectTitle);
|
|
404
|
+
const existed = project.sessionIds.includes(subject.chatId);
|
|
405
|
+
const stored = !existed && await isStored(services.persistence, subject.chatId);
|
|
406
|
+
if (!existed && !stored) {
|
|
407
|
+
if (services.persistence === void 0) throw new AgentUnavailableError("this DSH profile cannot store the opening of an authoring chat");
|
|
408
|
+
await storeAuthoringOpening(services.persistence, {
|
|
409
|
+
id: subject.chatId,
|
|
410
|
+
cwd: project.path,
|
|
411
|
+
agentPreset: kind.agentPreset
|
|
412
|
+
}, prompts.text(kind.welcome, language, subject.welcome), kind.openingSource);
|
|
413
|
+
}
|
|
414
|
+
return await ensureAgentChat(services, {
|
|
415
|
+
projectPath,
|
|
416
|
+
projectTitle: kind.projectTitle,
|
|
417
|
+
sessionId: subject.chatId,
|
|
418
|
+
agentPreset: kind.agentPreset,
|
|
419
|
+
title: subject.title,
|
|
420
|
+
renameExisting: subject.renameExisting
|
|
421
|
+
}, project);
|
|
422
|
+
}
|
|
423
|
+
const KIND = {
|
|
424
|
+
folder: "worlds",
|
|
425
|
+
projectTitle: "World Authoring",
|
|
426
|
+
agentPreset: "world-authoring",
|
|
427
|
+
welcome: "world/welcome"
|
|
428
|
+
};
|
|
401
429
|
/** The title of a world's authoring chat, in the language of the person who opened it. */
|
|
402
430
|
function authoringTitle(worldName, language) {
|
|
403
431
|
return translator(languageOf(language))("Authoring {name}", { name: worldName });
|
|
@@ -415,30 +443,14 @@ var AuthoringSessions = class {
|
|
|
415
443
|
this.languages = languages;
|
|
416
444
|
}
|
|
417
445
|
async ensure(worldId, worldName, title, language) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const existed = project.sessionIds.includes(sessionId);
|
|
425
|
-
const stored = !existed && await isStored(services.persistence, sessionId);
|
|
426
|
-
if (!existed && !stored) {
|
|
427
|
-
if (services.persistence === void 0) throw new AgentUnavailableError("this DSH profile cannot store the opening of an authoring chat");
|
|
428
|
-
await storeAuthoringOpening(services.persistence, {
|
|
429
|
-
id: sessionId,
|
|
430
|
-
cwd: project.path,
|
|
431
|
-
agentPreset: AUTHORING_AGENT_PRESET
|
|
432
|
-
}, this.prompts.text("world/welcome", this.languages.get(worldId), { world: worldName }));
|
|
433
|
-
}
|
|
434
|
-
return await ensureAgentChat(services, {
|
|
435
|
-
projectPath,
|
|
436
|
-
projectTitle: AUTHORING_PROJECT_TITLE,
|
|
437
|
-
sessionId,
|
|
438
|
-
agentPreset: AUTHORING_AGENT_PRESET,
|
|
439
|
-
title: chatTitle,
|
|
446
|
+
return await ensureAuthoringChat(this.services(), this.roleplayRoot(), this.prompts, this.languages, KIND, {
|
|
447
|
+
chatId: authoringChatSessionId(worldId),
|
|
448
|
+
languageKey: worldId,
|
|
449
|
+
title: title ?? authoringTitle(worldName, language),
|
|
450
|
+
language,
|
|
451
|
+
welcome: { world: worldName },
|
|
440
452
|
renameExisting: true
|
|
441
|
-
}
|
|
453
|
+
});
|
|
442
454
|
}
|
|
443
455
|
/** Sends a message into a chat as if the person had written it. */
|
|
444
456
|
async send(sessionId, text) {
|
|
@@ -453,8 +465,7 @@ var AuthoringSessions = class {
|
|
|
453
465
|
}, new AbortController().signal);
|
|
454
466
|
}
|
|
455
467
|
};
|
|
456
|
-
|
|
457
|
-
//#region src/host/import/card-tools.ts
|
|
468
|
+
// src/host/import/card-tools.ts
|
|
458
469
|
/** The most of a piece one `card_read` returns; a long lorebook entry is read in turns. */
|
|
459
470
|
const READ_CHARS = 6e3;
|
|
460
471
|
const SNIPPET_CHARS = 240;
|
|
@@ -823,8 +834,7 @@ function originOf(card, choices, pieces, records, name) {
|
|
|
823
834
|
}];
|
|
824
835
|
});
|
|
825
836
|
}
|
|
826
|
-
|
|
827
|
-
//#region src/host/import/card-diff.ts
|
|
837
|
+
// src/host/import/card-diff.ts
|
|
828
838
|
const MAX_SEGMENTS = 1500;
|
|
829
839
|
const MAX_HUNK_CHARS = 700;
|
|
830
840
|
/** Entries that kept neither their title nor their keys count as the same one only when this much of their words is shared. */
|
|
@@ -996,8 +1006,7 @@ function worldFieldChanges(before, after) {
|
|
|
996
1006
|
});
|
|
997
1007
|
return changes;
|
|
998
1008
|
}
|
|
999
|
-
|
|
1000
|
-
//#region src/host/import/update.ts
|
|
1009
|
+
// src/host/import/update.ts
|
|
1001
1010
|
const PREVIOUS_FOLDER = "previous";
|
|
1002
1011
|
const CLASSIFICATION = "classification.json";
|
|
1003
1012
|
const sameName = (a, b) => a.normalize("NFKC").trim().toLowerCase() === b.normalize("NFKC").trim().toLowerCase();
|
|
@@ -1170,6 +1179,11 @@ async function finishUpdate(directory, options = {}) {
|
|
|
1170
1179
|
});
|
|
1171
1180
|
const pictures = await updatePictures(directory, current.card.urls ?? [], next.card.urls ?? [], options);
|
|
1172
1181
|
const portrait = newPicture === void 0 ? "none" : oldPicture !== void 0 && oldPicture.equals(newPicture) ? "kept" : await refreshPortrait(directory, newPicture, next.card.name);
|
|
1182
|
+
await recordProvenance(directory, {
|
|
1183
|
+
kind: "update",
|
|
1184
|
+
card: { name: next.card.name },
|
|
1185
|
+
language: ""
|
|
1186
|
+
}, await readFile(join(folder, "card.json"), "utf8"));
|
|
1173
1187
|
await writeSnapshot(directory);
|
|
1174
1188
|
return {
|
|
1175
1189
|
forgotten,
|
|
@@ -1257,8 +1271,7 @@ async function refreshPortrait(directory, picture, cardName) {
|
|
|
1257
1271
|
}))) return "kept";
|
|
1258
1272
|
return await writePortrait(directory, picture, documents, cardName) ? "replaced" : "kept";
|
|
1259
1273
|
}
|
|
1260
|
-
|
|
1261
|
-
//#region src/host/translate/terms.ts
|
|
1274
|
+
// src/host/translate/terms.ts
|
|
1262
1275
|
const STOP = /* @__PURE__ */ new Set([
|
|
1263
1276
|
"the",
|
|
1264
1277
|
"and",
|
|
@@ -1346,8 +1359,7 @@ function usesTerm(text, term) {
|
|
|
1346
1359
|
const escaped = term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1347
1360
|
return new RegExp(`(?<![\\p{L}\\p{N}])${escaped}(?![\\p{L}\\p{N}])`, "u").test(text);
|
|
1348
1361
|
}
|
|
1349
|
-
|
|
1350
|
-
//#region src/host/translate/prose.ts
|
|
1362
|
+
// src/host/translate/prose.ts
|
|
1351
1363
|
const rooted = (roots, paths) => roots.flatMap((root) => paths.map((path) => `${root}${path}`));
|
|
1352
1364
|
const INTENT = [
|
|
1353
1365
|
".name",
|
|
@@ -1572,8 +1584,7 @@ async function readWorldDocuments(directory) {
|
|
|
1572
1584
|
}
|
|
1573
1585
|
return found;
|
|
1574
1586
|
}
|
|
1575
|
-
|
|
1576
|
-
//#region src/host/translate/translate-world.ts
|
|
1587
|
+
// src/host/translate/translate-world.ts
|
|
1577
1588
|
/** What is not carried over to a translation: the removed things of the editor and the card import's working files. */
|
|
1578
1589
|
const NOT_COPIED = /* @__PURE__ */ new Set([".trash", ".import"]);
|
|
1579
1590
|
const TERMS_PER_JOB = 40;
|
|
@@ -1820,8 +1831,7 @@ async function translateWorld(ctx, worlds, source, to, told) {
|
|
|
1820
1831
|
])
|
|
1821
1832
|
};
|
|
1822
1833
|
}
|
|
1823
|
-
|
|
1824
|
-
//#region src/host/translate/tools.ts
|
|
1834
|
+
// src/host/translate/tools.ts
|
|
1825
1835
|
const TRANSLATE_TOOL = "translate_world";
|
|
1826
1836
|
/** The message that has the authoring chat translate its world, in the language of the person who asked. */
|
|
1827
1837
|
function translateMessage(text, to, language) {
|
|
@@ -1860,20 +1870,7 @@ function translateTools(worlds, settings, prompting) {
|
|
|
1860
1870
|
}
|
|
1861
1871
|
})];
|
|
1862
1872
|
}
|
|
1863
|
-
|
|
1864
|
-
//#region src/host/worlds/world-info.ts
|
|
1865
|
-
async function replaceFile$2(file, text) {
|
|
1866
|
-
const temporary = join(dirname(file), `.${basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
1867
|
-
try {
|
|
1868
|
-
const { mode } = await stat(file);
|
|
1869
|
-
await writeFile(temporary, text, { mode });
|
|
1870
|
-
await chmod(temporary, mode);
|
|
1871
|
-
await rename(temporary, file);
|
|
1872
|
-
} catch (error) {
|
|
1873
|
-
await rm(temporary, { force: true });
|
|
1874
|
-
throw error;
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1873
|
+
// src/host/worlds/world-info.ts
|
|
1877
1874
|
const textOf$1 = (value) => typeof value === "string" ? value : "";
|
|
1878
1875
|
const toolsOf = (value) => {
|
|
1879
1876
|
const board = value === void 0 ? {} : parseSwitchboard(value, "tools");
|
|
@@ -1928,7 +1925,10 @@ function setOrRemove(document, key, value) {
|
|
|
1928
1925
|
* back as the world will be read before it is written.
|
|
1929
1926
|
* @throws {InvalidEditProblems} when the world would no longer be valid.
|
|
1930
1927
|
*/
|
|
1931
|
-
|
|
1928
|
+
function editWorldInfo(directory, edit) {
|
|
1929
|
+
return serialized(directory, () => changeWorldInfo(directory, edit));
|
|
1930
|
+
}
|
|
1931
|
+
async function changeWorldInfo(directory, edit) {
|
|
1932
1932
|
const { text, document } = await readDocument(directory);
|
|
1933
1933
|
const before = infoOf(document);
|
|
1934
1934
|
if (edit.opening !== void 0 && before.openingParts && edit.opening !== before.opening) throw new InvalidEditProblems(["the opening has lines spoken by characters: change it in the file, or ask the authoring assistant"]);
|
|
@@ -1982,11 +1982,10 @@ async function editWorldInfo(directory, edit) {
|
|
|
1982
1982
|
const next = JSON.stringify(document, null, /^([ \t]+)"/m.exec(text)?.[1] ?? " ") + (text.endsWith("\n") ? "\n" : "");
|
|
1983
1983
|
const parsed = parseWorldFile(next);
|
|
1984
1984
|
if (!parsed.ok) throw new InvalidEditProblems(parsed.issues.map(formatIssue));
|
|
1985
|
-
await
|
|
1985
|
+
await atomicWrite(join(directory, WORLD_FILE_NAME), next);
|
|
1986
1986
|
return infoOf(document);
|
|
1987
1987
|
}
|
|
1988
|
-
|
|
1989
|
-
//#region src/host/import/preset-tools.ts
|
|
1988
|
+
// src/host/import/preset-tools.ts
|
|
1990
1989
|
const PRESET_TOOL = "import_preset";
|
|
1991
1990
|
const PRESET_FILE = "preset.json";
|
|
1992
1991
|
const PRESET_PATH = `${IMPORT_FOLDER}/${PRESET_FILE}`;
|
|
@@ -2044,8 +2043,7 @@ function presetTools(worlds, settings, prompting) {
|
|
|
2044
2043
|
}
|
|
2045
2044
|
})];
|
|
2046
2045
|
}
|
|
2047
|
-
|
|
2048
|
-
//#region src/host/triggers/parts.ts
|
|
2046
|
+
// src/host/triggers/parts.ts
|
|
2049
2047
|
/** What the files of a world say it has, for checking what a trigger names. @throws {InvalidEditProblems} when those files have problems of their own: they are fixed first. */
|
|
2050
2048
|
async function loadWorldParts(directory) {
|
|
2051
2049
|
const { characters, problems: characterProblems } = await loadCharacters(directory);
|
|
@@ -2073,8 +2071,7 @@ async function loadWorldParts(directory) {
|
|
|
2073
2071
|
calendar
|
|
2074
2072
|
};
|
|
2075
2073
|
}
|
|
2076
|
-
|
|
2077
|
-
//#region src/host/triggers/check.ts
|
|
2074
|
+
// src/host/triggers/check.ts
|
|
2078
2075
|
/**
|
|
2079
2076
|
* What each trigger names that the world does not have (a character, place, item or variable in its condition, its cues or the words of a
|
|
2080
2077
|
* cue), found as a session start finds it: against a scratch story made from the world's files. Triggers that wait for each other count
|
|
@@ -2113,8 +2110,7 @@ function triggerProblemsOf(parts, definitions) {
|
|
|
2113
2110
|
}
|
|
2114
2111
|
return found;
|
|
2115
2112
|
}
|
|
2116
|
-
|
|
2117
|
-
//#region src/host/triggers/files.ts
|
|
2113
|
+
// src/host/triggers/files.ts
|
|
2118
2114
|
/** The fields of a trigger in the file; any other is a mistake that would otherwise be dropped without a word. */
|
|
2119
2115
|
const FIELDS = /* @__PURE__ */ new Set([
|
|
2120
2116
|
"key",
|
|
@@ -2148,16 +2144,7 @@ async function readTriggerDocuments(directory) {
|
|
|
2148
2144
|
return data;
|
|
2149
2145
|
}
|
|
2150
2146
|
async function writeDocuments(directory, documents) {
|
|
2151
|
-
|
|
2152
|
-
const temporary = join(dirname(file), `.${basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
2153
|
-
try {
|
|
2154
|
-
const mode = await stat(file).then((value) => value.mode, () => void 0);
|
|
2155
|
-
await writeFile(temporary, `${JSON.stringify(documents, null, 2)}\n`, mode === void 0 ? {} : { mode });
|
|
2156
|
-
await rename(temporary, file);
|
|
2157
|
-
} catch (error) {
|
|
2158
|
-
await rm(temporary, { force: true });
|
|
2159
|
-
throw error;
|
|
2160
|
-
}
|
|
2147
|
+
await atomicWriteJson(join(directory, TRIGGERS_FILE_NAME), documents, { indent: 2 });
|
|
2161
2148
|
}
|
|
2162
2149
|
/** The keys of the triggers a condition waits for. */
|
|
2163
2150
|
function waitsFor(condition) {
|
|
@@ -2216,8 +2203,7 @@ async function deleteTriggerDocument(directory, key) {
|
|
|
2216
2203
|
await writeDocuments(directory, documents.filter((entry) => entry !== found));
|
|
2217
2204
|
return kept;
|
|
2218
2205
|
}
|
|
2219
|
-
|
|
2220
|
-
//#region src/host/worlds/world-editor.ts
|
|
2206
|
+
// src/host/worlds/world-editor.ts
|
|
2221
2207
|
function stateOf(world, definition, names) {
|
|
2222
2208
|
const { start } = definition;
|
|
2223
2209
|
const portrait = referenceImagePath(world.directory, {
|
|
@@ -2513,7 +2499,7 @@ async function editWorldPlots(world, edit) {
|
|
|
2513
2499
|
cooldown_days: plot.pacing.cooldownDays
|
|
2514
2500
|
}
|
|
2515
2501
|
}));
|
|
2516
|
-
await replaceFile
|
|
2502
|
+
await replaceFile(join(world.directory, PLOTS_FILE_NAME), JSON.stringify(document, null, 2) + "\n");
|
|
2517
2503
|
return await readWorldEditor(world);
|
|
2518
2504
|
}
|
|
2519
2505
|
async function editWorldLore(world, key, edit) {
|
|
@@ -2552,7 +2538,7 @@ async function editWorldNarrationVoice(world, voice) {
|
|
|
2552
2538
|
const document = JSON.parse(text);
|
|
2553
2539
|
if (voice.trim() === "") delete document["narration_voice"];
|
|
2554
2540
|
else document["narration_voice"] = voice.trim();
|
|
2555
|
-
await replaceFile
|
|
2541
|
+
await replaceFile(file, JSON.stringify(document, null, /^([ \t]+)"/m.exec(text)?.[1] ?? " ") + (text.endsWith("\n") ? "\n" : ""));
|
|
2556
2542
|
return await readWorldEditor(world);
|
|
2557
2543
|
}
|
|
2558
2544
|
const relationKey = (...parts) => parts.map((part) => encodeURIComponent(part)).join(":");
|
|
@@ -2638,21 +2624,7 @@ function apply(document, edit, problems) {
|
|
|
2638
2624
|
}
|
|
2639
2625
|
}
|
|
2640
2626
|
/** Written in one step, so an interruption cannot leave a character file half written. */
|
|
2641
|
-
|
|
2642
|
-
const temporary = join(dirname(file), `.${basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
2643
|
-
try {
|
|
2644
|
-
const mode = await stat(file).then((value) => value.mode, (error) => {
|
|
2645
|
-
if (error.code === "ENOENT") return 420;
|
|
2646
|
-
throw error;
|
|
2647
|
-
});
|
|
2648
|
-
await writeFile(temporary, text, { mode });
|
|
2649
|
-
await chmod(temporary, mode);
|
|
2650
|
-
await rename(temporary, file);
|
|
2651
|
-
} catch (error) {
|
|
2652
|
-
await rm(temporary, { force: true });
|
|
2653
|
-
throw error;
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2627
|
+
const replaceFile = atomicWrite;
|
|
2656
2628
|
/**
|
|
2657
2629
|
* Change a character in a world's files: the file is read, changed and checked as a whole (it has to read as a valid character, and the place has to be a place of
|
|
2658
2630
|
* the world) before it is written, so a refused edit changes nothing. Whatever the file holds that the editor does not know stays.
|
|
@@ -2674,7 +2646,7 @@ async function editWorldCharacter(world, key, edit) {
|
|
|
2674
2646
|
const parsed = parseCharacterFile(next, folder);
|
|
2675
2647
|
if (!parsed.ok) problems.push(...parsed.issues.map(formatIssue));
|
|
2676
2648
|
if (problems.length > 0) throw new InvalidEditProblems(problems);
|
|
2677
|
-
await replaceFile
|
|
2649
|
+
await replaceFile(file, next);
|
|
2678
2650
|
return await readWorldEditor(world);
|
|
2679
2651
|
}
|
|
2680
2652
|
async function entityFolder(worldDirectory, directory, fileName, key, parse) {
|
|
@@ -2704,7 +2676,7 @@ async function editEntityFile(world, directory, fileName, key, parse, mutate) {
|
|
|
2704
2676
|
const next = JSON.stringify(document, null, /^([ \t]+)"/m.exec(text)?.[1] ?? " ") + (text.endsWith("\n") ? "\n" : "");
|
|
2705
2677
|
const parsed = parse(next, folder);
|
|
2706
2678
|
if (!parsed.ok) throw new InvalidEditProblems((parsed.issues ?? []).map(formatIssue));
|
|
2707
|
-
await replaceFile
|
|
2679
|
+
await replaceFile(file, next);
|
|
2708
2680
|
return await readWorldEditor(world);
|
|
2709
2681
|
}
|
|
2710
2682
|
async function editWorldPlace(world, key, edit) {
|
|
@@ -3119,8 +3091,7 @@ async function removeWorldTrigger(world, key) {
|
|
|
3119
3091
|
await deleteTriggerDocument(world.directory, key);
|
|
3120
3092
|
return await readWorldEditor(world);
|
|
3121
3093
|
}
|
|
3122
|
-
|
|
3123
|
-
//#region src/host/authoring/documents.ts
|
|
3094
|
+
// src/host/authoring/documents.ts
|
|
3124
3095
|
const AUTHORED_ENTITY_KINDS = [
|
|
3125
3096
|
"character",
|
|
3126
3097
|
"location",
|
|
@@ -3187,17 +3158,6 @@ function serializeDocument(kind, key, value) {
|
|
|
3187
3158
|
if (!parsed.ok) throw new InvalidEditProblems(parsed.issues.map(formatIssue));
|
|
3188
3159
|
return text;
|
|
3189
3160
|
}
|
|
3190
|
-
async function replaceFile(file, text) {
|
|
3191
|
-
const temporary = join(dirname(file), `.${basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
3192
|
-
try {
|
|
3193
|
-
const mode = await stat(file).then((value) => value.mode);
|
|
3194
|
-
await writeFile(temporary, text, { mode });
|
|
3195
|
-
await rename(temporary, file);
|
|
3196
|
-
} catch (error) {
|
|
3197
|
-
await rm(temporary, { force: true });
|
|
3198
|
-
throw error;
|
|
3199
|
-
}
|
|
3200
|
-
}
|
|
3201
3161
|
async function readAuthoredEntityDocument(world, kind, key) {
|
|
3202
3162
|
const found = await find(world, kind, key);
|
|
3203
3163
|
if (found === void 0) throw new InvalidEditProblems([`there is no ${kind} "${key}"`]);
|
|
@@ -3225,7 +3185,7 @@ async function createAuthoredEntity(world, kind, key, document) {
|
|
|
3225
3185
|
async function replaceAuthoredEntity(world, kind, key, document) {
|
|
3226
3186
|
const found = await find(world, kind, key);
|
|
3227
3187
|
if (found === void 0) throw new InvalidEditProblems([`there is no ${kind} "${key}"`]);
|
|
3228
|
-
await
|
|
3188
|
+
await atomicWrite(found.file, serializeDocument(kind, key, document));
|
|
3229
3189
|
}
|
|
3230
3190
|
/** Deletions remain recoverable without making the trash visible to the world loaders. */
|
|
3231
3191
|
async function deleteAuthoredEntity(world, kind, key) {
|
|
@@ -3237,8 +3197,7 @@ async function deleteAuthoredEntity(world, kind, key) {
|
|
|
3237
3197
|
await rename(dirname(found.file), destination);
|
|
3238
3198
|
return destination;
|
|
3239
3199
|
}
|
|
3240
|
-
|
|
3241
|
-
//#region src/host/interface/world-packs.ts
|
|
3200
|
+
// src/host/interface/world-packs.ts
|
|
3242
3201
|
/** The kinds of file an assistant may write, as text. */
|
|
3243
3202
|
const TEXT_EXTENSIONS = [
|
|
3244
3203
|
"html",
|
|
@@ -3290,8 +3249,7 @@ async function deleteWorldPackFile(directory, pack, path) {
|
|
|
3290
3249
|
}]
|
|
3291
3250
|
};
|
|
3292
3251
|
}
|
|
3293
|
-
|
|
3294
|
-
//#region src/host/authoring/pack-jail.ts
|
|
3252
|
+
// src/host/authoring/pack-jail.ts
|
|
3295
3253
|
/** DSH's own file tools, which the world authoring chat uses on the interface packs and nothing else. */
|
|
3296
3254
|
const PACK_FILE_TOOLS = [
|
|
3297
3255
|
"read",
|
|
@@ -3381,7 +3339,6 @@ async function packJail(exec, next, deps) {
|
|
|
3381
3339
|
function registerPackJail(ctx, deps) {
|
|
3382
3340
|
ctx.on("tools/pre-execute", (exec, next) => packJail(exec, next, deps), { prepend: true });
|
|
3383
3341
|
}
|
|
3384
|
-
|
|
3385
|
-
export { matchPieces as $, worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile$1 as E, loadWorldParts as F, findTargets as G, translateTools as H, PRESET_FILE as I, revertUpdate as J, finishUpdate as K, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, diffText as Q, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, updateStatus as X, startUpdate as Y, cardChanges as Z, editWorldPlots as _, deleteWorldPackFile as a, authoringTitle as at, entityFolder as b, createAuthoredEntity as c, ensureAgentChat as ct, replaceAuthoredEntity as d, appendNarratedTurn as dt, worldFieldChanges as et, editWorldCharacter as f, storeAuthoringOpening as ft, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, AuthoringSessions as it, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, isStored as lt, editWorldLore as m, packFileProblem as n, entitiesByPiece as nt, listWorldPacks as o, AgentSessions as ot, editWorldFaction as p, storeDoctorOpening as pt, pendingUpdate as q, registerPackJail as r, readSource as rt, AUTHORED_ENTITY_KINDS as s, agentServicesOf as st, MAX_PACK_TEXT as t, cardTools as tt, readAuthoredEntityDocument as u, appendEmptyTurn as ut, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
|
|
3342
|
+
export { matchPieces as $, worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, loadWorldParts as F, findTargets as G, translateTools as H, PRESET_FILE as I, revertUpdate as J, finishUpdate as K, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, diffText as Q, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, updateStatus as X, startUpdate as Y, cardChanges as Z, editWorldPlots as _, deleteWorldPackFile as a, authoringTitle as at, entityFolder as b, createAuthoredEntity as c, agentServicesOf as ct, replaceAuthoredEntity as d, appendNarratedTurn as dt, worldFieldChanges as et, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, AuthoringSessions as it, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, DOCTOR_OPENING_SOURCE as lt, editWorldLore as m, packFileProblem as n, entitiesByPiece as nt, listWorldPacks as o, ensureAuthoringChat as ot, editWorldFaction as p, pendingUpdate as q, registerPackJail as r, readSource as rt, AUTHORED_ENTITY_KINDS as s, AgentSessions as st, MAX_PACK_TEXT as t, cardTools as tt, readAuthoredEntityDocument as u, appendEmptyTurn as ut, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
|
|
3386
3343
|
|
|
3387
|
-
//# sourceMappingURL=pack-jail-
|
|
3344
|
+
//# sourceMappingURL=pack-jail-CN-314ln.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as Reader } from "./hooks-rQTTeOC4.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";
|
|
5
|
-
|
|
5
|
+
// src/shared/worlds.ts
|
|
6
6
|
/** Path prefix of the plugin's HTTP API. Relative, so a mounted deployment resolves it against the page. */
|
|
7
7
|
const API_PREFIX = "roleplay-api";
|
|
8
|
-
|
|
9
|
-
//#region src/shared/interface-pack.ts
|
|
8
|
+
// src/shared/interface-pack.ts
|
|
10
9
|
/** What a surface may do for the player; a pack lists the ones it uses. */
|
|
11
10
|
const PACK_ACTIONS = [
|
|
12
11
|
"say",
|
|
@@ -75,8 +74,7 @@ const PACK_MEDIA_TYPES = {
|
|
|
75
74
|
ogg: "audio/ogg",
|
|
76
75
|
wav: "audio/wav"
|
|
77
76
|
};
|
|
78
|
-
|
|
79
|
-
//#region src/host/interface/skin.ts
|
|
77
|
+
// src/host/interface/skin.ts
|
|
80
78
|
const NESTABLE = /* @__PURE__ */ new Set(["media", "supports"]);
|
|
81
79
|
const FORBIDDEN_TEXT = [
|
|
82
80
|
"expression(",
|
|
@@ -382,8 +380,7 @@ function checkSkin(css, url) {
|
|
|
382
380
|
problems: context.problems
|
|
383
381
|
};
|
|
384
382
|
}
|
|
385
|
-
|
|
386
|
-
//#region src/host/interface/pack.ts
|
|
383
|
+
// src/host/interface/pack.ts
|
|
387
384
|
const ID = /^[\p{L}\p{N}][\p{L}\p{N}_-]{0,59}$/u;
|
|
388
385
|
const SEGMENT = /^[\p{L}\p{N}_.-]+$/u;
|
|
389
386
|
const TOKEN_NAME = /^--dsw-alias-[a-z0-9-]+$/;
|
|
@@ -837,7 +834,6 @@ function anyTab(bases) {
|
|
|
837
834
|
}
|
|
838
835
|
}));
|
|
839
836
|
}
|
|
840
|
-
//#endregion
|
|
841
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 };
|
|
842
838
|
|
|
843
|
-
//# sourceMappingURL=packs-
|
|
839
|
+
//# sourceMappingURL=packs-DIj5BEfq.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { t as promptFor } from "./access-
|
|
2
|
-
import { c as runChild } from "./child-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
1
|
+
import { t as promptFor } from "./access-CfQWbNZP.js";
|
|
2
|
+
import { c as runChild } from "./child-lYYeOwl2.js";
|
|
3
|
+
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-CLPosooC.js";
|
|
4
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-D1V4h8vh.js";
|
|
5
|
+
import { c as nextSceneSerial, u as referenceImagePath } from "./library-Dfu0dgRj.js";
|
|
6
6
|
import { dirname, join, relative } from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
|
-
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
10
9
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
10
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
11
11
|
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
12
|
-
|
|
12
|
+
// src/host/images/presented.ts
|
|
13
13
|
const PRESENTED_FOLDER = "presented";
|
|
14
14
|
const fileOf = (folder, node) => join(folder, "images", PRESENTED_FOLDER, `${node}.json`);
|
|
15
15
|
/** The images shown for a timeline node that were not made for it. */
|
|
@@ -34,8 +34,7 @@ async function present(sessionFolder, node, image) {
|
|
|
34
34
|
}] }, null, 2));
|
|
35
35
|
await rename(temporary, file);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
//#region src/host/images/image-search.ts
|
|
37
|
+
// src/host/images/image-search.ts
|
|
39
38
|
const WORD = /[\p{L}\p{N}]+/gu;
|
|
40
39
|
const CJK = /[㐀-鿿-ヿ가-]/u;
|
|
41
40
|
/** Function words that say nothing about a picture, so that "a boat at anchor" does not find a wood because both have an "a". */
|
|
@@ -118,8 +117,7 @@ function searchImages(images, query) {
|
|
|
118
117
|
};
|
|
119
118
|
}).filter((match) => match.score > 0).sort((a, b) => b.score - a.score || b.image.createdAt.localeCompare(a.image.createdAt)).slice(0, query.limit ?? 5);
|
|
120
119
|
}
|
|
121
|
-
|
|
122
|
-
//#region src/host/images/image-vectors.ts
|
|
120
|
+
// src/host/images/image-vectors.ts
|
|
123
121
|
const VECTORS_FILE = ".vectors.json";
|
|
124
122
|
/** Images closer than this to the query by meaning are candidates even when they share no word with it. */
|
|
125
123
|
const MIN_SIMILARITY = .35;
|
|
@@ -251,8 +249,7 @@ async function findImages(sessionFolder, images, query, embedder, signal) {
|
|
|
251
249
|
};
|
|
252
250
|
}
|
|
253
251
|
}
|
|
254
|
-
|
|
255
|
-
//#region src/host/images/tools.ts
|
|
252
|
+
// src/host/images/tools.ts
|
|
256
253
|
const kindSchema = {
|
|
257
254
|
type: "string",
|
|
258
255
|
enum: [
|
|
@@ -664,8 +661,7 @@ function imageTools(deps) {
|
|
|
664
661
|
transient
|
|
665
662
|
];
|
|
666
663
|
}
|
|
667
|
-
|
|
668
|
-
//#region src/host/images/interpreter.ts
|
|
664
|
+
// src/host/images/interpreter.ts
|
|
669
665
|
const RESULT$1 = {
|
|
670
666
|
type: "object",
|
|
671
667
|
properties: {
|
|
@@ -796,8 +792,7 @@ async function interpretImage(job) {
|
|
|
796
792
|
subjects: answer.subjects
|
|
797
793
|
});
|
|
798
794
|
}
|
|
799
|
-
|
|
800
|
-
//#region src/host/images/presenter-agent.ts
|
|
795
|
+
// src/host/images/presenter-agent.ts
|
|
801
796
|
const RESULT = {
|
|
802
797
|
type: "object",
|
|
803
798
|
properties: { summary: {
|
|
@@ -849,7 +844,6 @@ async function runImagePresenter(job) {
|
|
|
849
844
|
images: [...generated]
|
|
850
845
|
};
|
|
851
846
|
}
|
|
852
|
-
//#endregion
|
|
853
847
|
export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
|
|
854
848
|
|
|
855
|
-
//# sourceMappingURL=presenter-agent-
|
|
849
|
+
//# sourceMappingURL=presenter-agent-DR0KvLE0.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as SAMPLING_RANGES } from "./child-
|
|
3
|
-
|
|
1
|
+
import { Pt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BgmC2oqU.js";
|
|
2
|
+
import { l as SAMPLING_RANGES } from "./child-lYYeOwl2.js";
|
|
3
|
+
import { J as cleanText } from "./presets-HB8kJTaE.js";
|
|
4
|
+
// src/host/import/preset.ts
|
|
4
5
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
5
6
|
const LEGACY_KEYS = [
|
|
6
7
|
"main_prompt",
|
|
@@ -236,7 +237,6 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
236
237
|
}];
|
|
237
238
|
return Buffer.from(JSON.stringify(kept));
|
|
238
239
|
}
|
|
239
|
-
//#endregion
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-CscHj1-Y.js.map
|