@dsh-agentic-roleplay/core 0.3.6 → 0.4.0
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/{tools-Dy1fgP6B.js → authoring-tools-C_8ClUkP.js} +129 -25
- package/lib/authoring.js +7 -5
- package/lib/{child-CFjnaTZt.js → child-DsixtqTw.js} +94 -2
- package/lib/client.js +3714 -2264
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +1 -1
- package/lib/doctor.js +2 -4
- package/lib/{gallery-DIEgETzU.js → gallery-CDYKJf_O.js} +2 -2
- package/lib/{generator-DJ48HxPI.js → generator-BR1ugzln.js} +2 -2
- package/lib/{deliver-BBgciEEK.js → hooks-B2EhBS_-.js} +1884 -236
- package/lib/images.js +4 -4
- package/lib/index.js +846 -254
- package/lib/{library-9JB9zw5a.js → library-COIktKBa.js} +4 -3
- package/lib/{lorebook-author-tools-Bj31z1cu.js → lorebook-author-tools-C-o0t4dL.js} +118 -43
- package/lib/lorebook-authoring.js +5 -3
- package/lib/{settings-CA6icLL_.js → narration-BT9uvQry.js} +145 -2
- package/lib/orchestration.js +34 -21
- package/lib/{pack-jail-2XztyYAX.js → pack-jail-soI-In96.js} +170 -13
- package/lib/{packs-xHRCcGdb.js → packs-CJPSe5LI.js} +7 -4
- package/lib/{presenter-agent-DnNEG_Mn.js → presenter-agent-Gu34bZwd.js} +6 -6
- package/lib/preset-3zn8xme7.js +242 -0
- package/lib/{preset-author-tools-BxycmoAr.js → preset-author-tools-C-X8G40s.js} +7 -7
- package/lib/preset-authoring.js +6 -3
- package/lib/{presets-gkBWAiVb.js → presets-C3mhqqfz.js} +9 -26
- package/lib/{reflection-q0UpwXlx.js → reflection-Btsj0ZLh.js} +51 -17
- package/package.json +2 -2
- package/packs/scene/map.html +1 -0
- package/packs/scene/strip.html +1 -0
- package/prompts/en/import/lorebook.md +2 -1
- package/prompts/en/import/style.md +1 -0
- package/prompts/en/lorebook/procedure.md +1 -1
- package/prompts/en/preset/procedure.md +1 -1
- package/prompts/en/roleplay/character-lookup.md +1 -0
- package/prompts/en/roleplay/game-master.md +1 -1
- package/prompts/en/world/procedure.md +1 -1
- package/prompts/zh/import/lorebook.md +2 -1
- package/prompts/zh/import/style.md +1 -0
- package/prompts/zh/lorebook/procedure.md +1 -1
- package/prompts/zh/preset/procedure.md +1 -1
- package/prompts/zh/roleplay/character-lookup.md +1 -0
- package/prompts/zh/roleplay/game-master.md +1 -1
- package/prompts/zh/world/procedure.md +1 -1
- package/lib/hooks-DkwFGtNH.js +0 -1060
- package/lib/language-BgyxtB2h.js +0 -38
- package/lib/load-CVwJjIJ5.js +0 -486
- package/lib/narration-DK2kiIjE.js +0 -141
- package/lib/preset-D0FMSeZ9.js +0 -59
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { v as writeWorldPrompt } from "./presets-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
1
|
+
import { $ as LOCATION_FILE_NAME, A as loadTriggers, At as parseLoreFile, B as loadItems, C as populateLocations, D as populateVariables, Dt as LORE_DIR, F as loadCalendar, G as extractStyleFrom, H as loadFactions, J as withPlayer, L as LOCATIONS_DIR, Mt as InvalidEditProblems, Ot as loadLore, R as loadLocations, U as CHARACTERS_DIR, V as FACTIONS_DIR, W as loadCharacters, X as loadVariables, _ as populateCharacters, at as CHARACTER_FILE_NAME, c as authoredWorldOf, dt as WORLD_FILE_NAME, et as parseLocationFile, ft as parseWorldFile, h as knowsCharacter, i as contextOf, it as parseFactionFile, jt as subfolders, k as TRIGGERS_FILE_NAME, kt as LORE_FILE_NAME, m as loadValidatedWorld, nt as parseItemFile, ot as parseCharacterFile, rt as FACTION_FILE_NAME, s as worldOf, st as IMPORT_FOLDER, tt as ITEM_FILE_NAME, x as populateItems, z as ITEMS_DIR } from "./authoring-tools-C_8ClUkP.js";
|
|
2
|
+
import { v as writeWorldPrompt } from "./presets-C3mhqqfz.js";
|
|
3
|
+
import { f as parseSwitchboard } from "./narration-BT9uvQry.js";
|
|
4
|
+
import { G as PROMPTS_FOLDER, H as formatIssue, I as PLOTS_FILE_NAME, L as loadPlots, M as STORY_LANGUAGES, N as isStoryLanguage, P as textLanguage, Q as shippedLanguages, R as parsePlotsFile, j as LANGUAGE_NAMES, nt as InvalidWorldError, z as plotReferenceProblems } from "./hooks-B2EhBS_-.js";
|
|
5
|
+
import { s as parseSampling } from "./child-DsixtqTw.js";
|
|
6
|
+
import { c as referenceImagePath, v as mapLimit } from "./library-COIktKBa.js";
|
|
7
|
+
import { n as readPreset } from "./preset-3zn8xme7.js";
|
|
8
|
+
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-CJPSe5LI.js";
|
|
9
|
+
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
|
|
9
10
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
10
11
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
11
12
|
import { randomUUID } from "node:crypto";
|
|
@@ -59,7 +60,17 @@ const MIN_USES = 3;
|
|
|
59
60
|
const capitalised = (word) => /^\p{Lu}[\p{L}'’-]{2,}$/u.test(word) && !STOP.has(word.toLowerCase());
|
|
60
61
|
/** The parts of a name written "Place - Room": each part is a name of its own, and so is the whole. */
|
|
61
62
|
function partsOfName(name) {
|
|
62
|
-
|
|
63
|
+
const parts = [];
|
|
64
|
+
let start = 0;
|
|
65
|
+
for (let at = 1; at < name.length - 1; at += 1) {
|
|
66
|
+
if (!"-–—".includes(name[at]) || !/\s/u.test(name[at - 1]) || !/\s/u.test(name[at + 1])) continue;
|
|
67
|
+
const part = name.slice(start, at).trim();
|
|
68
|
+
if (part !== "") parts.push(part);
|
|
69
|
+
start = at + 1;
|
|
70
|
+
}
|
|
71
|
+
const last = name.slice(start).trim();
|
|
72
|
+
if (last !== "") parts.push(last);
|
|
73
|
+
return parts;
|
|
63
74
|
}
|
|
64
75
|
/**
|
|
65
76
|
* Words of the world that recur inside other names and texts and so have to be rendered once: the parts of names ("Iron Stag Inn" in "Iron Stag Inn - Bar") and capitalised
|
|
@@ -605,6 +616,131 @@ function translateTools(worlds, settings, prompting) {
|
|
|
605
616
|
})];
|
|
606
617
|
}
|
|
607
618
|
//#endregion
|
|
619
|
+
//#region src/host/worlds/world-info.ts
|
|
620
|
+
async function replaceFile$2(file, text) {
|
|
621
|
+
const temporary = join(dirname(file), `.${basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
622
|
+
try {
|
|
623
|
+
const { mode } = await stat(file);
|
|
624
|
+
await writeFile(temporary, text, { mode });
|
|
625
|
+
await chmod(temporary, mode);
|
|
626
|
+
await rename(temporary, file);
|
|
627
|
+
} catch (error) {
|
|
628
|
+
await rm(temporary, { force: true });
|
|
629
|
+
throw error;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
const textOf$1 = (value) => typeof value === "string" ? value : "";
|
|
633
|
+
const toolsOf = (value) => {
|
|
634
|
+
const board = value === void 0 ? {} : parseSwitchboard(value, "tools");
|
|
635
|
+
return typeof board === "string" ? {} : board;
|
|
636
|
+
};
|
|
637
|
+
function infoOf(document) {
|
|
638
|
+
const opening = document["opening_message"];
|
|
639
|
+
const parts = Array.isArray(opening) && opening.some((part) => typeof part === "object" && part !== null && part["type"] === "utterance");
|
|
640
|
+
const plain = typeof opening === "string" ? opening : Array.isArray(opening) ? opening.map((part) => textOf$1(part?.["text"])).filter((text) => text !== "").join("\n\n") : "";
|
|
641
|
+
const metadata = typeof document["metadata"] === "object" && document["metadata"] !== null ? document["metadata"] : {};
|
|
642
|
+
const author = typeof document["author"] === "object" && document["author"] !== null ? document["author"] : {};
|
|
643
|
+
const rules = document["rules"];
|
|
644
|
+
return {
|
|
645
|
+
name: textOf$1(document["name"]),
|
|
646
|
+
description: textOf$1(document["description"]),
|
|
647
|
+
tags: Array.isArray(metadata["tags"]) ? metadata["tags"].filter((tag) => typeof tag === "string") : [],
|
|
648
|
+
rules: typeof rules === "string" ? [rules] : Array.isArray(rules) ? rules.filter((rule) => typeof rule === "string") : [],
|
|
649
|
+
opening: plain,
|
|
650
|
+
openingParts: parts,
|
|
651
|
+
authorName: textOf$1(author["name"]),
|
|
652
|
+
authorUrl: textOf$1(author["url"]),
|
|
653
|
+
timeZone: textOf$1(document["time_zone"]),
|
|
654
|
+
startingTime: textOf$1(document["starting_time"]),
|
|
655
|
+
preset: textOf$1(document["preset"]),
|
|
656
|
+
lorebooks: Array.isArray(document["lorebooks"]) ? document["lorebooks"].filter((name) => typeof name === "string") : [],
|
|
657
|
+
version: typeof document["version"] === "number" ? String(document["version"]) : textOf$1(document["version"]),
|
|
658
|
+
sampling: parseSampling(document["sampling"], "sampling", []),
|
|
659
|
+
tools: toolsOf(document["tools"]),
|
|
660
|
+
alternateOpenings: Array.isArray(document["alternate_openings"]) ? document["alternate_openings"].flatMap((entry) => typeof entry === "object" && entry !== null && typeof entry["text"] === "string" ? [{
|
|
661
|
+
title: textOf$1(entry["title"]),
|
|
662
|
+
text: entry["text"],
|
|
663
|
+
...textOf$1(entry["character"]) === "" ? {} : { character: textOf$1(entry["character"]) }
|
|
664
|
+
}] : []) : []
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
async function readDocument(directory) {
|
|
668
|
+
const text = await readFile(join(directory, WORLD_FILE_NAME), "utf8");
|
|
669
|
+
return {
|
|
670
|
+
text,
|
|
671
|
+
document: JSON.parse(text.replace(/^/, ""))
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
async function readWorldInfo(directory) {
|
|
675
|
+
return infoOf((await readDocument(directory)).document);
|
|
676
|
+
}
|
|
677
|
+
function setOrRemove(document, key, value) {
|
|
678
|
+
if (value === "") delete document[key];
|
|
679
|
+
else document[key] = value;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Changes the fields of `world.json` the edit names and nothing else, keeping the file's other fields and its indentation. The result is read
|
|
683
|
+
* back as the world will be read before it is written.
|
|
684
|
+
* @throws {InvalidEditProblems} when the world would no longer be valid.
|
|
685
|
+
*/
|
|
686
|
+
async function editWorldInfo(directory, edit) {
|
|
687
|
+
const { text, document } = await readDocument(directory);
|
|
688
|
+
const before = infoOf(document);
|
|
689
|
+
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"]);
|
|
690
|
+
if (edit.name !== void 0) document["name"] = edit.name;
|
|
691
|
+
if (edit.description !== void 0) document["description"] = edit.description;
|
|
692
|
+
if (edit.tags !== void 0) document["metadata"] = {
|
|
693
|
+
...typeof document["metadata"] === "object" && document["metadata"] !== null ? document["metadata"] : {},
|
|
694
|
+
tags: edit.tags
|
|
695
|
+
};
|
|
696
|
+
if (edit.rules !== void 0) {
|
|
697
|
+
if (edit.rules.length === 0) delete document["rules"];
|
|
698
|
+
else document["rules"] = edit.rules;
|
|
699
|
+
}
|
|
700
|
+
if (edit.opening !== void 0 && !before.openingParts) setOrRemove(document, "opening_message", edit.opening);
|
|
701
|
+
if (edit.authorName !== void 0 || edit.authorUrl !== void 0) {
|
|
702
|
+
const name = edit.authorName ?? before.authorName;
|
|
703
|
+
const url = edit.authorUrl ?? before.authorUrl;
|
|
704
|
+
if (name === "" && url !== "") throw new InvalidEditProblems(["an author link needs the author's name"]);
|
|
705
|
+
if (name === "") delete document["author"];
|
|
706
|
+
else document["author"] = {
|
|
707
|
+
...typeof document["author"] === "object" && document["author"] !== null ? document["author"] : {},
|
|
708
|
+
name,
|
|
709
|
+
...url === "" ? {} : { url }
|
|
710
|
+
};
|
|
711
|
+
if (url === "" && typeof document["author"] === "object") delete document["author"]["url"];
|
|
712
|
+
}
|
|
713
|
+
if (edit.timeZone !== void 0) setOrRemove(document, "time_zone", edit.timeZone);
|
|
714
|
+
if (edit.startingTime !== void 0) setOrRemove(document, "starting_time", edit.startingTime);
|
|
715
|
+
if (edit.version !== void 0) setOrRemove(document, "version", edit.version);
|
|
716
|
+
if (edit.preset !== void 0) setOrRemove(document, "preset", edit.preset);
|
|
717
|
+
if (edit.lorebooks !== void 0) {
|
|
718
|
+
if (edit.lorebooks.length === 0) delete document["lorebooks"];
|
|
719
|
+
else document["lorebooks"] = edit.lorebooks;
|
|
720
|
+
}
|
|
721
|
+
if (edit.alternateOpenings !== void 0) {
|
|
722
|
+
if (edit.alternateOpenings.length === 0) delete document["alternate_openings"];
|
|
723
|
+
else document["alternate_openings"] = edit.alternateOpenings.map((entry) => ({
|
|
724
|
+
title: entry.title === "" ? entry.text.slice(0, 40) : entry.title,
|
|
725
|
+
text: entry.text,
|
|
726
|
+
...entry.character === void 0 || entry.character === "" ? {} : { character: entry.character }
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
if (edit.sampling !== void 0) {
|
|
730
|
+
if (Object.keys(edit.sampling).length === 0) delete document["sampling"];
|
|
731
|
+
else document["sampling"] = edit.sampling;
|
|
732
|
+
}
|
|
733
|
+
if (edit.tools !== void 0) {
|
|
734
|
+
if (Object.keys(edit.tools).length === 0) delete document["tools"];
|
|
735
|
+
else document["tools"] = edit.tools;
|
|
736
|
+
}
|
|
737
|
+
const next = JSON.stringify(document, null, /^([ \t]+)"/m.exec(text)?.[1] ?? " ") + (text.endsWith("\n") ? "\n" : "");
|
|
738
|
+
const parsed = parseWorldFile(next);
|
|
739
|
+
if (!parsed.ok) throw new InvalidEditProblems(parsed.issues.map(formatIssue));
|
|
740
|
+
await replaceFile$2(join(directory, WORLD_FILE_NAME), next);
|
|
741
|
+
return infoOf(document);
|
|
742
|
+
}
|
|
743
|
+
//#endregion
|
|
608
744
|
//#region src/host/import/preset-tools.ts
|
|
609
745
|
const PRESET_TOOL = "import_preset";
|
|
610
746
|
const PRESET_FILE = "preset.json";
|
|
@@ -615,7 +751,7 @@ const presetMessage = () => `Apply the narration preset I uploaded to this world
|
|
|
615
751
|
function presetTools(worlds, settings, prompting) {
|
|
616
752
|
return [defineTool({
|
|
617
753
|
name: PRESET_TOOL,
|
|
618
|
-
description: `Turn the narration preset the person uploaded to this world (${PRESET_PATH}) into the world's prose prompts: how the narration is written and how the characters speak and behave. Rules of the game, formats and scripts in the preset are not carried. It replaces the world's own versions of those prompts, so the person is asked first.`,
|
|
754
|
+
description: `Turn the narration preset the person uploaded to this world (${PRESET_PATH}) into the world's prose prompts: how the narration is written and how the characters speak and behave. Rules of the game, formats and scripts in the preset are not carried; the sampling it asks (temperature and so on) is written into the world's suggested sampling. It replaces the world's own versions of those prompts, so the person is asked first.`,
|
|
619
755
|
parameters: { file: {
|
|
620
756
|
type: "string",
|
|
621
757
|
required: true,
|
|
@@ -640,14 +776,20 @@ function presetTools(worlds, settings, prompting) {
|
|
|
640
776
|
const text = (id, variables) => prompting.prompts().text(id, language, variables);
|
|
641
777
|
const made = await extractStyleFrom(contextOf(exec, settings(), text), preset.name, preset.pieces);
|
|
642
778
|
for (const { id, text: body } of made.prompts) for (const tag of shippedLanguages()) await writeWorldPrompt(world.directory, tag, id, withPlayer(body));
|
|
779
|
+
const carriesSampling = Object.keys(preset.sampling).length > 0;
|
|
780
|
+
if (carriesSampling) {
|
|
781
|
+
await editWorldInfo(world.directory, { sampling: preset.sampling });
|
|
782
|
+
await worlds.list({ refresh: true });
|
|
783
|
+
}
|
|
643
784
|
await rm(file, { force: true });
|
|
644
785
|
const written = made.prompts.map((entry) => entry.id);
|
|
645
786
|
return JSON.parse(JSON.stringify({
|
|
646
787
|
preset: preset.name,
|
|
647
788
|
written,
|
|
789
|
+
sampling: carriesSampling ? preset.sampling : void 0,
|
|
648
790
|
folder: `${PROMPTS_FOLDER}/<language>/`,
|
|
649
791
|
notes: made.notes,
|
|
650
|
-
next: written.length === 0 ? "Nothing in the preset was about how to write the story, so no prompt was changed: tell the person." : "Tell the person which prompts were written (they can read and edit them in the world's Prompts section) and what was not carried over."
|
|
792
|
+
next: written.length === 0 ? "Nothing in the preset was about how to write the story, so no prompt was changed: tell the person." : "Tell the person which prompts were written (they can read and edit them in the world's Prompts section), the sampling that was set (About section) and what was not carried over."
|
|
651
793
|
}));
|
|
652
794
|
}
|
|
653
795
|
})];
|
|
@@ -1078,6 +1220,8 @@ async function readWorldEditor(world) {
|
|
|
1078
1220
|
key: entry.id,
|
|
1079
1221
|
title: entry.title,
|
|
1080
1222
|
kind: entry.kind,
|
|
1223
|
+
scope: entry.scope,
|
|
1224
|
+
knownBy: entry.knownBy,
|
|
1081
1225
|
summary: entry.summary,
|
|
1082
1226
|
body: entry.body,
|
|
1083
1227
|
...entry.startsAt === void 0 ? {} : { startsAt: entry.startsAt },
|
|
@@ -1123,9 +1267,22 @@ async function editWorldPlots(world, edit) {
|
|
|
1123
1267
|
return await readWorldEditor(world);
|
|
1124
1268
|
}
|
|
1125
1269
|
async function editWorldLore(world, key, edit) {
|
|
1270
|
+
if (edit.knownBy !== void 0) {
|
|
1271
|
+
const { characters } = await loadCharacters(world.directory);
|
|
1272
|
+
const strangers = edit.knownBy.filter((name) => !knowsCharacter(characters, name));
|
|
1273
|
+
if (strangers.length > 0) throw new InvalidEditProblems(strangers.map((name) => `"${name}" is not a character of this world`));
|
|
1274
|
+
}
|
|
1126
1275
|
return await editEntityFile(world, LORE_DIR, LORE_FILE_NAME, key, parseLoreFile, (document) => {
|
|
1127
1276
|
if (edit.title !== void 0) document["title"] = edit.title;
|
|
1128
1277
|
if (edit.kind !== void 0) document["kind"] = edit.kind;
|
|
1278
|
+
if (edit.scope !== void 0) {
|
|
1279
|
+
document["scope"] = edit.scope;
|
|
1280
|
+
if (edit.scope === "everyone" && edit.knownBy === void 0) delete document["known_by"];
|
|
1281
|
+
}
|
|
1282
|
+
if (edit.knownBy !== void 0) {
|
|
1283
|
+
if (edit.knownBy.length === 0) delete document["known_by"];
|
|
1284
|
+
else document["known_by"] = edit.knownBy;
|
|
1285
|
+
}
|
|
1129
1286
|
if (edit.summary !== void 0) setOptional(document, "summary", edit.summary);
|
|
1130
1287
|
if (edit.body !== void 0) setOptional(document, "body", edit.body);
|
|
1131
1288
|
if (edit.sources !== void 0) document["sources"] = edit.sources;
|
|
@@ -1975,6 +2132,6 @@ function registerPackJail(ctx, deps) {
|
|
|
1975
2132
|
ctx.on("tools/pre-execute", (exec, next) => packJail(exec, next, deps), { prepend: true });
|
|
1976
2133
|
}
|
|
1977
2134
|
//#endregion
|
|
1978
|
-
export { worldEntityImageFile as A,
|
|
2135
|
+
export { worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile$1 as E, loadWorldParts as F, translateTools as H, PRESET_FILE as I, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, editWorldLore as m, packFileProblem as n, listWorldPacks as o, editWorldFaction as p, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
|
|
1979
2136
|
|
|
1980
|
-
//# sourceMappingURL=pack-jail-
|
|
2137
|
+
//# sourceMappingURL=pack-jail-soI-In96.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as Reader } from "./hooks-B2EhBS_-.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";
|
|
@@ -228,8 +228,11 @@ function declarationProblem(body, url) {
|
|
|
228
228
|
problem: "@import is not allowed"
|
|
229
229
|
};
|
|
230
230
|
let problem;
|
|
231
|
-
const css = body.replace(/url\(
|
|
232
|
-
const
|
|
231
|
+
const css = body.replace(/url\(([^)]*)\)/gi, (match, raw) => {
|
|
232
|
+
const value = raw.trim();
|
|
233
|
+
const quoted = value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'");
|
|
234
|
+
if (!quoted && /\s/u.test(value)) return match;
|
|
235
|
+
const path = quoted ? value.slice(1, -1) : value;
|
|
233
236
|
if (path === "" || /^[a-z][a-z0-9+.-]*:/i.test(path) || path.startsWith("/") || path.startsWith("#")) {
|
|
234
237
|
problem ??= `url(${path}) must be a path inside the pack`;
|
|
235
238
|
return match;
|
|
@@ -837,4 +840,4 @@ function anyTab(bases) {
|
|
|
837
840
|
//#endregion
|
|
838
841
|
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 };
|
|
839
842
|
|
|
840
|
-
//# sourceMappingURL=packs-
|
|
843
|
+
//# sourceMappingURL=packs-CJPSe5LI.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as promptFor } from "./access-EbNdZFbk.js";
|
|
2
|
-
import { a as runChild } from "./child-
|
|
3
|
-
import { c as referenceImagePath, o as nextSceneSerial } from "./library-
|
|
4
|
-
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-
|
|
5
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
2
|
+
import { a as runChild } from "./child-DsixtqTw.js";
|
|
3
|
+
import { c as referenceImagePath, o as nextSceneSerial } from "./library-COIktKBa.js";
|
|
4
|
+
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
|
|
5
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-CDYKJf_O.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";
|
|
@@ -125,7 +125,7 @@ const VECTORS_FILE = ".vectors.json";
|
|
|
125
125
|
const MIN_SIMILARITY = .35;
|
|
126
126
|
const FUSION_CONSTANT = 60;
|
|
127
127
|
const DENSE_LIMIT = 10;
|
|
128
|
-
const hashOf = (text) => createHash("
|
|
128
|
+
const hashOf = (text) => createHash("sha256").update(text).digest("hex");
|
|
129
129
|
function cosine(a, b) {
|
|
130
130
|
let dot = 0;
|
|
131
131
|
let x = 0;
|
|
@@ -852,4 +852,4 @@ async function runImagePresenter(job) {
|
|
|
852
852
|
//#endregion
|
|
853
853
|
export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
|
|
854
854
|
|
|
855
|
-
//# sourceMappingURL=presenter-agent-
|
|
855
|
+
//# sourceMappingURL=presenter-agent-Gu34bZwd.js.map
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { Bt as ImportCardError, K as cleanText, r as MAX_PREVIEW_TEXT } from "./authoring-tools-C_8ClUkP.js";
|
|
2
|
+
import { o as SAMPLING_RANGES } from "./child-DsixtqTw.js";
|
|
3
|
+
//#region src/host/import/preset.ts
|
|
4
|
+
/** The older preset layout keeps its texts under fixed keys. */
|
|
5
|
+
const LEGACY_KEYS = [
|
|
6
|
+
"main_prompt",
|
|
7
|
+
"nsfw_prompt",
|
|
8
|
+
"jailbreak_prompt",
|
|
9
|
+
"impersonation_prompt",
|
|
10
|
+
"new_chat_prompt",
|
|
11
|
+
"new_group_chat_prompt",
|
|
12
|
+
"new_example_chat_prompt"
|
|
13
|
+
];
|
|
14
|
+
const MAX_PIECES = 60;
|
|
15
|
+
const MAX_PIECE_CHARS = 8e3;
|
|
16
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
const text = (value) => typeof value === "string" ? value.trim() : "";
|
|
18
|
+
/** Prompts sent as the model's own turn are prefills for one particular model, not instructions. */
|
|
19
|
+
const PREFILL_ROLES = ["assistant", "model"];
|
|
20
|
+
/** The text of the macro that opens at `from` (just after its `{{`), up to its matching `}}`, or undefined when it never closes. */
|
|
21
|
+
function macroEnd(source, from) {
|
|
22
|
+
let depth = 1;
|
|
23
|
+
for (let at = from; at < source.length - 1; at += 1) if (source.startsWith("{{", at)) {
|
|
24
|
+
depth += 1;
|
|
25
|
+
at += 1;
|
|
26
|
+
} else if (source.startsWith("}}", at)) {
|
|
27
|
+
depth -= 1;
|
|
28
|
+
if (depth === 0) return at;
|
|
29
|
+
at += 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Splits a macro's inside at its `::`, leaving the macros nested in an argument whole. */
|
|
33
|
+
function macroParts(inside) {
|
|
34
|
+
const parts = [];
|
|
35
|
+
let depth = 0;
|
|
36
|
+
let start = 0;
|
|
37
|
+
for (let at = 0; at < inside.length; at += 1) if (inside.startsWith("{{", at)) {
|
|
38
|
+
depth += 1;
|
|
39
|
+
at += 1;
|
|
40
|
+
} else if (inside.startsWith("}}", at)) {
|
|
41
|
+
depth -= 1;
|
|
42
|
+
at += 1;
|
|
43
|
+
} else if (depth === 0 && inside.startsWith("::", at)) {
|
|
44
|
+
parts.push(inside.slice(start, at));
|
|
45
|
+
start = at + 2;
|
|
46
|
+
at += 1;
|
|
47
|
+
}
|
|
48
|
+
return [...parts, inside.slice(start)];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Plays the variable macros of a preset (`setvar`, `addvar`, `getvar`), drops its comments and `trim` markers and shows a `random` as all its choices, so that a text reads as it will to the model.
|
|
52
|
+
* The variables belong to the whole preset: a prompt early in the order may set what a later one reads.
|
|
53
|
+
*/
|
|
54
|
+
function resolveMacros(source, variables) {
|
|
55
|
+
let out = "";
|
|
56
|
+
let at = 0;
|
|
57
|
+
for (;;) {
|
|
58
|
+
const open = source.indexOf("{{", at);
|
|
59
|
+
const close = open === -1 ? void 0 : macroEnd(source, open + 2);
|
|
60
|
+
if (open === -1 || close === void 0) return out + source.slice(at);
|
|
61
|
+
out += source.slice(at, open);
|
|
62
|
+
const parts = macroParts(source.slice(open + 2, close));
|
|
63
|
+
const name = (parts[0] ?? "").trim();
|
|
64
|
+
const args = parts.slice(1).map((part) => resolveMacros(part, variables));
|
|
65
|
+
if (name.startsWith("//") || name.toLowerCase() === "trim") out += "";
|
|
66
|
+
else if (name === "setvar" || name === "setglobalvar") variables.set(args[0] ?? "", args.slice(1).join("::"));
|
|
67
|
+
else if (name === "addvar" || name === "addglobalvar") variables.set(args[0] ?? "", `${variables.get(args[0] ?? "") ?? ""}${args.slice(1).join("::")}`);
|
|
68
|
+
else if (name === "getvar" || name === "getglobalvar") out += variables.get(args[0] ?? "") ?? "";
|
|
69
|
+
else if (name === "random") out += args.join(" / ");
|
|
70
|
+
else out += source.slice(open, close + 2);
|
|
71
|
+
at = close + 2;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The order the preset sends its prompts in: the longest list it gives, with what each entry says about being on. */
|
|
75
|
+
function orderOf(root) {
|
|
76
|
+
return ((Array.isArray(root["prompt_order"]) ? root["prompt_order"].flatMap((entry) => isObject(entry) && Array.isArray(entry["order"]) ? [entry["order"]] : []) : []).sort((a, b) => b.length - a.length)[0] ?? []).flatMap((entry) => isObject(entry) && typeof entry["identifier"] === "string" ? [{
|
|
77
|
+
identifier: entry["identifier"],
|
|
78
|
+
enabled: entry["enabled"] !== false
|
|
79
|
+
}] : []);
|
|
80
|
+
}
|
|
81
|
+
/** The sampling fields of a preset file and the control of a story each sets; a value that leaves the choice to the server is not carried. */
|
|
82
|
+
const SAMPLING_FIELDS = {
|
|
83
|
+
top_p: "topP",
|
|
84
|
+
top_k: "topK",
|
|
85
|
+
min_p: "minP",
|
|
86
|
+
frequency_penalty: "frequencyPenalty",
|
|
87
|
+
presence_penalty: "presencePenalty",
|
|
88
|
+
repetition_penalty: "repetitionPenalty"
|
|
89
|
+
};
|
|
90
|
+
/** What the file asks of the model's sampling. The one temperature is asked of the narrator and of the characters. */
|
|
91
|
+
function samplingOf(root) {
|
|
92
|
+
const sampling = {};
|
|
93
|
+
const within = (key, value) => {
|
|
94
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
95
|
+
const { min, max } = SAMPLING_RANGES[key];
|
|
96
|
+
return value < min || value > max ? void 0 : value;
|
|
97
|
+
};
|
|
98
|
+
const temperature = within("master", root["temperature"]);
|
|
99
|
+
if (temperature !== void 0) {
|
|
100
|
+
sampling["master"] = temperature;
|
|
101
|
+
sampling["characters"] = temperature;
|
|
102
|
+
}
|
|
103
|
+
for (const [field, key] of Object.entries(SAMPLING_FIELDS)) {
|
|
104
|
+
const value = within(key, root[field]);
|
|
105
|
+
if (value !== void 0 && value !== SAMPLING_RANGES[key].neutral) sampling[key] = value;
|
|
106
|
+
}
|
|
107
|
+
return sampling;
|
|
108
|
+
}
|
|
109
|
+
function parseRoot(file) {
|
|
110
|
+
let root;
|
|
111
|
+
try {
|
|
112
|
+
root = JSON.parse(file.toString("utf8").replace(/^\uFEFF/, ""));
|
|
113
|
+
} catch {
|
|
114
|
+
throw new ImportCardError("the file is not JSON: a preset is the .json file SillyTavern exports");
|
|
115
|
+
}
|
|
116
|
+
if (!isObject(root)) throw new ImportCardError("the file is not a preset: it must be a JSON object");
|
|
117
|
+
return root;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The prompts of a preset in the order it sends them, those it has switched off included, without the markers that stand for chat history or a card's fields.
|
|
121
|
+
* Prompts the order never names are not sent by the tool that wrote it and are not offered.
|
|
122
|
+
*/
|
|
123
|
+
function promptsOf(root) {
|
|
124
|
+
const prompts = Array.isArray(root["prompts"]) ? root["prompts"].filter(isObject) : [];
|
|
125
|
+
const found = [];
|
|
126
|
+
const add = (prompt, on) => {
|
|
127
|
+
const id = text(prompt["identifier"]);
|
|
128
|
+
if (id === "" || prompt["marker"] === true || text(prompt["content"]) === "" || found.some((entry) => entry.id === id)) return;
|
|
129
|
+
found.push({
|
|
130
|
+
id,
|
|
131
|
+
title: text(prompt["name"]),
|
|
132
|
+
role: text(prompt["role"]),
|
|
133
|
+
content: text(prompt["content"]),
|
|
134
|
+
on,
|
|
135
|
+
raw: prompt
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
if (prompts.length === 0) {
|
|
139
|
+
for (const key of LEGACY_KEYS) if (text(root[key]) !== "") add({
|
|
140
|
+
identifier: key,
|
|
141
|
+
name: key,
|
|
142
|
+
role: "system",
|
|
143
|
+
content: root[key]
|
|
144
|
+
}, true);
|
|
145
|
+
return found;
|
|
146
|
+
}
|
|
147
|
+
const byId = new Map(prompts.flatMap((prompt) => typeof prompt["identifier"] === "string" ? [[prompt["identifier"], prompt]] : []));
|
|
148
|
+
const ordered = orderOf(root);
|
|
149
|
+
if (ordered.length === 0) {
|
|
150
|
+
for (const prompt of prompts) add(prompt, prompt["enabled"] !== false);
|
|
151
|
+
return found;
|
|
152
|
+
}
|
|
153
|
+
for (const entry of ordered) {
|
|
154
|
+
const prompt = byId.get(entry.identifier);
|
|
155
|
+
if (prompt !== void 0) add(prompt, entry.enabled);
|
|
156
|
+
}
|
|
157
|
+
return found;
|
|
158
|
+
}
|
|
159
|
+
const isPrefill = (prompt) => PREFILL_ROLES.includes(prompt.role);
|
|
160
|
+
/**
|
|
161
|
+
* Reads a preset file. Markers (places where chat history or the card's fields are inserted), switched-off prompts, prefills and empty ones are left out; the macros of the tool that wrote it are played, so that a text holds what it will say.
|
|
162
|
+
* @throws {ImportCardError} when the file is not a preset, with why.
|
|
163
|
+
*/
|
|
164
|
+
function readPreset(file, name) {
|
|
165
|
+
const root = parseRoot(file);
|
|
166
|
+
const pieces = [];
|
|
167
|
+
const variables = /* @__PURE__ */ new Map();
|
|
168
|
+
for (const prompt of promptsOf(root)) {
|
|
169
|
+
if (!prompt.on || isPrefill(prompt)) continue;
|
|
170
|
+
const content = cleanText(resolveMacros(prompt.content, variables), "the character");
|
|
171
|
+
if (content === "") continue;
|
|
172
|
+
pieces.push(`${prompt.title === "" ? "" : `[${prompt.title}]\n`}${content.slice(0, MAX_PIECE_CHARS)}`);
|
|
173
|
+
}
|
|
174
|
+
if (pieces.length === 0) throw new ImportCardError("the file holds no instructions this importer can read: a preset has a \"prompts\" list with texts in it");
|
|
175
|
+
const title = text(root["name"]) || text(root["preset_name"]);
|
|
176
|
+
return {
|
|
177
|
+
name: title === "" ? name.replace(/\.json$/i, "") : title,
|
|
178
|
+
pieces: pieces.slice(0, MAX_PIECES),
|
|
179
|
+
sampling: samplingOf(root)
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** The scripts a preset carries for the tool that wrote it (regular expressions run over replies, helper scripts), which nothing here runs. */
|
|
183
|
+
function scriptsOf(root) {
|
|
184
|
+
const extensions = isObject(root["extensions"]) ? root["extensions"] : {};
|
|
185
|
+
const regex = Array.isArray(extensions["regex_scripts"]) ? extensions["regex_scripts"].length : 0;
|
|
186
|
+
const helper = isObject(extensions["tavern_helper"]) && Array.isArray(extensions["tavern_helper"]["scripts"]) ? extensions["tavern_helper"]["scripts"].length : 0;
|
|
187
|
+
return {
|
|
188
|
+
...regex === 0 ? {} : { regexScripts: regex },
|
|
189
|
+
...helper === 0 ? {} : { scripts: helper }
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/** What a preset file offers, for the person to choose from. @throws {ImportCardError} when the file is not a preset. */
|
|
193
|
+
function previewPreset(file, name) {
|
|
194
|
+
const root = parseRoot(file);
|
|
195
|
+
const items = promptsOf(root).map((prompt) => ({
|
|
196
|
+
id: prompt.id,
|
|
197
|
+
title: prompt.title === "" ? prompt.id : prompt.title,
|
|
198
|
+
detail: prompt.role,
|
|
199
|
+
text: prompt.content.slice(0, MAX_PREVIEW_TEXT),
|
|
200
|
+
chars: prompt.content.length,
|
|
201
|
+
enabled: prompt.on && !isPrefill(prompt),
|
|
202
|
+
usable: !isPrefill(prompt),
|
|
203
|
+
...isPrefill(prompt) ? { note: "prefill" } : /\{\{\s*(?:set|add)(?:global)?var::/.test(prompt.content) ? { note: "variables" } : {}
|
|
204
|
+
}));
|
|
205
|
+
if (items.length === 0) throw new ImportCardError("the file holds no instructions this importer can read: a preset has a \"prompts\" list with texts in it");
|
|
206
|
+
const title = text(root["name"]) || text(root["preset_name"]);
|
|
207
|
+
return {
|
|
208
|
+
name: title === "" ? name.replace(/\.json$/i, "") : title,
|
|
209
|
+
items,
|
|
210
|
+
sampling: samplingOf(root),
|
|
211
|
+
ignored: scriptsOf(root)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The file with only the chosen prompts in it, in the order the preset sends them, as if the preset never had the others; the sampling stays only when asked.
|
|
216
|
+
* @throws {ImportCardError} when a chosen prompt is not in the file or nothing usable is chosen.
|
|
217
|
+
*/
|
|
218
|
+
function selectPrompts(file, enabled, keepSampling) {
|
|
219
|
+
const root = parseRoot(file);
|
|
220
|
+
const prompts = promptsOf(root);
|
|
221
|
+
const unknown = enabled.filter((id) => !prompts.some((prompt) => prompt.id === id));
|
|
222
|
+
if (unknown.length > 0) throw new ImportCardError(`the preset has no prompt ${unknown.map((id) => `"${id}"`).join(", ")}`);
|
|
223
|
+
const chosen = prompts.filter((prompt) => enabled.includes(prompt.id) && !isPrefill(prompt));
|
|
224
|
+
if (chosen.length === 0) throw new ImportCardError("choose at least one prompt of the preset");
|
|
225
|
+
const kept = { ...typeof root["name"] === "string" ? { name: root["name"] } : typeof root["preset_name"] === "string" ? { preset_name: root["preset_name"] } : {} };
|
|
226
|
+
if (keepSampling) {
|
|
227
|
+
for (const field of ["temperature", ...Object.keys(SAMPLING_FIELDS)]) if (root[field] !== void 0) kept[field] = root[field];
|
|
228
|
+
}
|
|
229
|
+
kept["prompts"] = chosen.map((prompt) => prompt.raw);
|
|
230
|
+
kept["prompt_order"] = [{
|
|
231
|
+
character_id: 100001,
|
|
232
|
+
order: chosen.map((prompt) => ({
|
|
233
|
+
identifier: prompt.id,
|
|
234
|
+
enabled: true
|
|
235
|
+
}))
|
|
236
|
+
}];
|
|
237
|
+
return Buffer.from(JSON.stringify(kept));
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
|
+
|
|
242
|
+
//# sourceMappingURL=preset-3zn8xme7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { G as extractStyleFrom, J as withPlayer, i as contextOf, st as IMPORT_FOLDER } from "./authoring-tools-C_8ClUkP.js";
|
|
2
|
+
import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-C3mhqqfz.js";
|
|
3
|
+
import { $ as shippedPromptsDirectory, Q as shippedLanguages, Y as languageOf } from "./hooks-B2EhBS_-.js";
|
|
4
|
+
import { n as readPreset$1 } from "./preset-3zn8xme7.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
@@ -161,7 +161,7 @@ function presetAuthorTools(reader, settings, prompting, shipped = shippedPrompts
|
|
|
161
161
|
}),
|
|
162
162
|
defineTool({
|
|
163
163
|
name: "write_preset_info",
|
|
164
|
-
description: "Change the preset's title, description (up to 300 characters each) and suggested
|
|
164
|
+
description: "Change the preset's title, description (up to 300 characters each) and suggested sampling. Give only what changes; sampling replaces the suggested values as a whole ({} suggests none): master and characters are temperatures from 0 to 2; topP and minP 0 to 1, topK 0 to 1000, frequencyPenalty and presencePenalty -2 to 2, repetitionPenalty 0 to 2 apply to both. Requires user approval.",
|
|
165
165
|
parameters: {
|
|
166
166
|
title: {
|
|
167
167
|
type: "string",
|
|
@@ -173,7 +173,7 @@ function presetAuthorTools(reader, settings, prompting, shipped = shippedPrompts
|
|
|
173
173
|
},
|
|
174
174
|
sampling: {
|
|
175
175
|
type: "json",
|
|
176
|
-
description: "For example {\"master\": 0.9, \"characters\": 0.85}."
|
|
176
|
+
description: "For example {\"master\": 0.9, \"characters\": 0.85, \"topP\": 0.95}."
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
179
|
output: jsonOutput,
|
|
@@ -273,4 +273,4 @@ async function presetApproval(exec, next, carries) {
|
|
|
273
273
|
//#endregion
|
|
274
274
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
275
275
|
|
|
276
|
-
//# sourceMappingURL=preset-author-tools-
|
|
276
|
+
//# sourceMappingURL=preset-author-tools-C-X8G40s.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-C_8ClUkP.js";
|
|
2
|
+
import { c as presetDirectory } from "./presets-C3mhqqfz.js";
|
|
3
|
+
import "./hooks-B2EhBS_-.js";
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-C-X8G40s.js";
|
|
4
5
|
import { join } from "node:path";
|
|
5
6
|
import { existsSync } from "node:fs";
|
|
6
7
|
//#region src/preset-authoring.ts
|
|
@@ -10,6 +11,7 @@ const inject = [
|
|
|
10
11
|
"roleplayImport",
|
|
11
12
|
"roleplayPrompts",
|
|
12
13
|
"roleplayAuthoringLanguages",
|
|
14
|
+
"roleplayAuthoringTools",
|
|
13
15
|
"tools",
|
|
14
16
|
"systemPrompt"
|
|
15
17
|
];
|
|
@@ -26,6 +28,7 @@ function apply(ctx) {
|
|
|
26
28
|
const preset = presetOfChat(chat);
|
|
27
29
|
return preset !== void 0 && existsSync(join(presetDirectory(library(), preset), "prompts"));
|
|
28
30
|
};
|
|
31
|
+
limitAuthoringAgents(ctx, (chat) => presetOfChat(chat) === void 0 ? void 0 : "presetAuthoring");
|
|
29
32
|
ctx.on("tools/pre-execute", (exec, next) => presetApproval(exec, next, carries));
|
|
30
33
|
const languageOf = (context) => {
|
|
31
34
|
const chat = context.agent?.session.id;
|