@dsh-agentic-roleplay/core 0.12.6 → 0.12.7
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/{authoring-tools-BpkpGMSO.js → authoring-tools-Bi9YQ9QH.js} +50 -16
- package/lib/authoring.js +227 -34
- package/lib/client.js +876 -519
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -2
- package/lib/doctor.js +2 -2
- package/lib/{library-CnWOHwQl.js → gallery-BT5lf-T5.js} +211 -6
- package/lib/{hooks-P_--KSFl.js → hooks-DR-HqE50.js} +4 -2
- package/lib/images.js +3 -4
- package/lib/index.js +84 -22
- package/lib/{presenter-agent-BTpJxmGi.js → interpreter-BYNrjYZo.js} +154 -63
- package/lib/{lorebook-author-tools-CWZ6WRN-.js → lorebook-author-tools-BI-r8fEt.js} +5 -5
- package/lib/lorebook-authoring.js +5 -5
- package/lib/{narration-DAHmte8p.js → narration-CUZIXzab.js} +8 -2
- package/lib/orchestration.js +56 -16
- package/lib/{pack-jail-DSTyLhMc.js → pack-jail-Y1XPbqHw.js} +18 -12
- package/lib/{packs-D9_N8kDF.js → packs-DD-v-Epl.js} +2 -2
- package/lib/presenter-agent-00sOVGI9.js +59 -0
- package/lib/{preset-B69AXtip.js → preset-Bnx3jhUv.js} +3 -3
- package/lib/{preset-author-tools-BJtt7D0J.js → preset-author-tools-DYrBcieA.js} +5 -5
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-2uzE3U-v.js → reflection-DqxoV9xE.js} +7 -6
- package/lib/{serial-DnVqMDe5.js → serial-CS46qAvI.js} +55 -9
- package/lib/{turn-guard-D4YHE00t.js → turn-guard-bZkxzRXJ.js} +2 -2
- package/package.json +3 -2
- package/prompts/en/import/finish-ok.md +2 -0
- package/prompts/en/roleplay/image-worth.md +5 -0
- package/prompts/zh/import/finish-ok.md +2 -0
- package/prompts/zh/roleplay/image-worth.md +5 -0
- package/lib/gallery-D0h0X7Jy.js +0 -190
- package/lib/generator-CAJkevKl.js +0 -150
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { T as currentTurn, c as namedModel, l as runChild, m as parseSampling, t as ChildTimeoutError } from "./child-Bfj7-Iuo.js";
|
|
2
|
-
import { $t as LOCATION_FILE_NAME, At as openingText, C as ROLE_TABLE, Ct as itemise, E as askYesNo, Et as IMPORT_FOLDER, Gt as dialectOf, Ht as importRequestOf, Jt as loadVariables, L as parseOpeningParts, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, P as MAX_OPENING_CHARS, Pt as InvalidEditProblems, Qt as parseLoreFile, R as partsText, S as ROLES, St as cleanText, Tt as withPlayer, Ut as findPanel, V as startQuestionsToFile, Vt as IMPORT_COMMAND, Wt as splitPanels, Xt as variableProblems, Zt as LORE_FILE_NAME, _ as pruneRelationships, a as characterDocument, an as FACTION_FILE_NAME, b as classifyItems, bt as loadLore, c as extractStyle, cn as parseCharacterFile, d as inert, en as parseLocationFile, f as loreDocuments, fn as WEEKDAY_NAMES, g as pruneMembers, h as pruneLoreSubjects, i as asWritten, in as parseSlotsFile, j as yesAt, k as noAt, kt as PICTURE_FILE, ln as guarded, m as pruneLinks, nn as SLOTS_FILE_NAME, o as emptyExtracted, on as parseFactionFile, p as pruneKnowledge, pn as DEFAULT_SLOTS, qt as VARIABLES_FILE_NAME, r as addLore, rn as parseItemFile, s as extractEntities, sn as CHARACTER_FILE_NAME, t as SerialQueue, tn as ITEM_FILE_NAME, u as extractVariables, v as sourcesFor, w as isLeftOut, x as findEntity, xt as subfolders, y as buildRoster, yt as LORE_DIR } from "./serial-
|
|
3
|
-
import {
|
|
2
|
+
import { $t as LOCATION_FILE_NAME, At as openingText, C as ROLE_TABLE, Ct as itemise, E as askYesNo, Et as IMPORT_FOLDER, Gt as dialectOf, Ht as importRequestOf, Jt as loadVariables, L as parseOpeningParts, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, P as MAX_OPENING_CHARS, Pt as InvalidEditProblems, Qt as parseLoreFile, R as partsText, S as ROLES, St as cleanText, Tt as withPlayer, Ut as findPanel, V as startQuestionsToFile, Vt as IMPORT_COMMAND, Wt as splitPanels, Xt as variableProblems, Zt as LORE_FILE_NAME, _ as pruneRelationships, a as characterDocument, an as FACTION_FILE_NAME, b as classifyItems, bt as loadLore, c as extractStyle, cn as parseCharacterFile, d as inert, en as parseLocationFile, f as loreDocuments, fn as WEEKDAY_NAMES, g as pruneMembers, h as pruneLoreSubjects, i as asWritten, in as parseSlotsFile, j as yesAt, k as noAt, kt as PICTURE_FILE, ln as guarded, m as pruneLinks, nn as SLOTS_FILE_NAME, o as emptyExtracted, on as parseFactionFile, p as pruneKnowledge, pn as DEFAULT_SLOTS, qt as VARIABLES_FILE_NAME, r as addLore, rn as parseItemFile, s as extractEntities, sn as CHARACTER_FILE_NAME, t as SerialQueue, tn as ITEM_FILE_NAME, u as extractVariables, v as sourcesFor, w as isLeftOut, x as findEntity, xt as subfolders, y as buildRoster, yt as LORE_DIR } from "./serial-CS46qAvI.js";
|
|
3
|
+
import { p as parseSwitchboard } from "./narration-CUZIXzab.js";
|
|
4
4
|
import { n as atomicWrite, r as atomicWriteJson } from "./access-5vtPAT3O.js";
|
|
5
|
-
import { $ as copyWorldPrompts, G as readDocument$1, J as errorMessage, K as Reader, U as commandFlagKey, V as plotReferenceProblems, Z as PROMPTS_FOLDER, c as externalWithheld, ht as registerCommands, it as shippedLanguages, lt as InvalidWorldError, nt as listFiles, o as externalGiven, ot as shippedText, q as formatIssue, rt as promptProblem, t as externalToolLimit, xt as COMPARISONS, z as loadPlots } from "./hooks-
|
|
5
|
+
import { $ as copyWorldPrompts, G as readDocument$1, J as errorMessage, K as Reader, U as commandFlagKey, V as plotReferenceProblems, Z as PROMPTS_FOLDER, c as externalWithheld, ht as registerCommands, it as shippedLanguages, lt as InvalidWorldError, nt as listFiles, o as externalGiven, ot as shippedText, q as formatIssue, rt as promptProblem, t as externalToolLimit, xt as COMPARISONS, z as loadPlots } from "./hooks-DR-HqE50.js";
|
|
6
6
|
import { t as trimCharacters } from "./text-B-HsLdb-.js";
|
|
7
|
-
import { C as
|
|
7
|
+
import { C as mapLimit, D as uniqueKey, E as trOf, S as NoEmbeddingService, T as slug, _ as MEDIA_TYPES, c as imageExtensionOf, l as libraryHashes, m as referenceImagePath, s as addToLibraryOnce, t as addCardLink, w as norm, y as writeImageFileMetadata } from "./gallery-BT5lf-T5.js";
|
|
8
8
|
import { join, relative, sep } from "node:path";
|
|
9
9
|
import { MINUTE, MONTH_NAMES, SEASONS, checkProblems, createSessionStore, dayTokenProblems, lintWorld, parseTimeOfDay, readTriggerDefinition, triggerReferenceProblems, writeCalendar } from "@dsh-agentic-roleplay/state";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
|
-
import { mkdtemp, readFile, readdir, rename, rm, stat } from "node:fs/promises";
|
|
11
|
+
import { access, mkdtemp, readFile, readdir, rename, rm, stat } from "node:fs/promises";
|
|
12
12
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
13
13
|
import { inflateSync } from "node:zlib";
|
|
14
14
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
@@ -799,6 +799,11 @@ function cardPieces(card, choices) {
|
|
|
799
799
|
}))
|
|
800
800
|
];
|
|
801
801
|
}
|
|
802
|
+
/** The ids of the pieces of the card that hold an address; none for one found only in scripts or other settings of the card. */
|
|
803
|
+
function pieceFinder(card, choices) {
|
|
804
|
+
const pieces = cardPieces(card, choices);
|
|
805
|
+
return (url) => pieces.filter((piece) => piece.text.includes(url)).map((piece) => piece.id);
|
|
806
|
+
}
|
|
802
807
|
async function optional(file) {
|
|
803
808
|
try {
|
|
804
809
|
return JSON.parse(await readFile(file, "utf8"));
|
|
@@ -1250,6 +1255,10 @@ function mendParts(source, parts, speakers) {
|
|
|
1250
1255
|
const mended = [];
|
|
1251
1256
|
let at = 0;
|
|
1252
1257
|
for (const part of parts) {
|
|
1258
|
+
if (part.type === "image") {
|
|
1259
|
+
mended.push(part);
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1253
1262
|
const found = source.indexOf(part.text, at);
|
|
1254
1263
|
if (found < 0) return [...parts];
|
|
1255
1264
|
const gap = unquoted(source.slice(at, found));
|
|
@@ -3156,8 +3165,13 @@ async function fetchPictures(world, urls, deps = {}) {
|
|
|
3156
3165
|
});
|
|
3157
3166
|
return;
|
|
3158
3167
|
}
|
|
3159
|
-
const
|
|
3168
|
+
const link = {
|
|
3169
|
+
url: address,
|
|
3170
|
+
pieces: deps.piecesOf?.(address) ?? []
|
|
3171
|
+
};
|
|
3172
|
+
const { path, added: isNew } = await addToLibraryOnce(world, reply.body, fileNameOf(url), hashes, link);
|
|
3160
3173
|
if (!isNew) {
|
|
3174
|
+
await addCardLink(world, path, link).catch(() => void 0);
|
|
3161
3175
|
skipped.push({
|
|
3162
3176
|
url: address,
|
|
3163
3177
|
reason: "a copy of another picture",
|
|
@@ -5442,6 +5456,22 @@ const about = {
|
|
|
5442
5456
|
where: "world.json",
|
|
5443
5457
|
message: "the world has no opening, so a story starts with \"The story begins.\""
|
|
5444
5458
|
});
|
|
5459
|
+
const shown = [...(info.openingParts ?? []).map((part) => ({
|
|
5460
|
+
where: "opening_message",
|
|
5461
|
+
part
|
|
5462
|
+
})), ...info.alternateOpenings.flatMap((entry, index) => (entry.parts ?? []).map((part) => ({
|
|
5463
|
+
where: `alternate_openings[${index}]`,
|
|
5464
|
+
part
|
|
5465
|
+
})))];
|
|
5466
|
+
for (const { where, part } of shown) {
|
|
5467
|
+
if (part.type !== "image") continue;
|
|
5468
|
+
if (await access(join(input.world.directory, "images", part.path)).then(() => false, () => true)) found.push({
|
|
5469
|
+
severity: "error",
|
|
5470
|
+
code: "opening-picture-missing",
|
|
5471
|
+
where,
|
|
5472
|
+
message: `the opening shows "${part.path}", which is not in the world's images, so no story can start with it`
|
|
5473
|
+
});
|
|
5474
|
+
}
|
|
5445
5475
|
return foundBy("quality-world", found);
|
|
5446
5476
|
}
|
|
5447
5477
|
};
|
|
@@ -5761,7 +5791,11 @@ const fetching = /* @__PURE__ */ new Map();
|
|
|
5761
5791
|
* Starts fetching the pictures the card points to, next to the work of the agents, once per import; a later call gets the same run or its saved result.
|
|
5762
5792
|
* A failure is a report of its own: pictures never stop an import.
|
|
5763
5793
|
*/
|
|
5764
|
-
|
|
5794
|
+
/** The addresses to download pictures from: none when the person turned downloading off. */
|
|
5795
|
+
function picturesToFetch(card, choices) {
|
|
5796
|
+
return choices.fetchPictures === false ? [] : card.urls ?? [];
|
|
5797
|
+
}
|
|
5798
|
+
function ensurePictures(world, urls, piecesOf) {
|
|
5765
5799
|
const running = fetching.get(world);
|
|
5766
5800
|
if (running !== void 0) return running;
|
|
5767
5801
|
const run = (async () => {
|
|
@@ -5770,7 +5804,7 @@ function ensurePictures(world, urls) {
|
|
|
5770
5804
|
} catch (error) {
|
|
5771
5805
|
if (error.code !== "ENOENT") throw error;
|
|
5772
5806
|
}
|
|
5773
|
-
const report = await fetchPictures(world, urls).catch((error) => ({
|
|
5807
|
+
const report = await fetchPictures(world, urls, { piecesOf }).catch((error) => ({
|
|
5774
5808
|
found: 0,
|
|
5775
5809
|
added: [],
|
|
5776
5810
|
skipped: [{
|
|
@@ -5865,8 +5899,8 @@ async function survey(ctx, world) {
|
|
|
5865
5899
|
"surveyed",
|
|
5866
5900
|
"built"
|
|
5867
5901
|
], "the survey");
|
|
5868
|
-
const { card, items } = await load(world);
|
|
5869
|
-
ensurePictures(world, card
|
|
5902
|
+
const { card, items, choices } = await load(world);
|
|
5903
|
+
ensurePictures(world, picturesToFetch(card, choices), pieceFinder(card, choices));
|
|
5870
5904
|
const { classified, failures, decided } = await classifyItems(ctx, card, items);
|
|
5871
5905
|
if (items.length > 0 && failures.length >= items.length && decided === 0) throw new Error(`no piece of the card could be read, so nothing was imported: ${failures[0]}`);
|
|
5872
5906
|
const { roster, failure } = await buildRoster(ctx, card, items.filter((item) => !isLeftOut(classified[item.id])), classified);
|
|
@@ -5902,8 +5936,8 @@ async function survey(ctx, world) {
|
|
|
5902
5936
|
/** Second step: write every character, place, faction, thing and background entry from the pieces that are about it. */
|
|
5903
5937
|
async function build(ctx, world) {
|
|
5904
5938
|
await need(world, ["surveyed", "built"], "the build");
|
|
5905
|
-
const { card, items } = await load(world);
|
|
5906
|
-
ensurePictures(world, card
|
|
5939
|
+
const { card, items, choices } = await load(world);
|
|
5940
|
+
ensurePictures(world, picturesToFetch(card, choices), pieceFinder(card, choices));
|
|
5907
5941
|
const classified = await readJson(join(folder(world), CLASSIFICATION));
|
|
5908
5942
|
const roster = await readJson(join(folder(world), ROSTER));
|
|
5909
5943
|
const extracted = await extractEntities(ctx, card, items.filter((item) => !isLeftOut(classified[item.id])), classified, roster);
|
|
@@ -5959,7 +5993,7 @@ async function finish(ctx, world) {
|
|
|
5959
5993
|
...emptyExtracted(),
|
|
5960
5994
|
...await readJson(join(folder(world), EXTRACTED)).catch(() => ({}))
|
|
5961
5995
|
};
|
|
5962
|
-
const pictures = await ensurePictures(world, card
|
|
5996
|
+
const pictures = await ensurePictures(world, picturesToFetch(card, choices), pieceFinder(card, choices));
|
|
5963
5997
|
const result = await finishImport(ctx, {
|
|
5964
5998
|
directory: world,
|
|
5965
5999
|
card,
|
|
@@ -6002,7 +6036,7 @@ async function structureImport(world, language) {
|
|
|
6002
6036
|
await need(world, ["ready"], "the import without a model");
|
|
6003
6037
|
const { card, choices, items, picture } = await load(world);
|
|
6004
6038
|
const { classified, roster, extracted } = structureOnly(card, items, choices);
|
|
6005
|
-
const pictures = await ensurePictures(world, card
|
|
6039
|
+
const pictures = await ensurePictures(world, picturesToFetch(card, choices), pieceFinder(card, choices));
|
|
6006
6040
|
const result = await finishImport({
|
|
6007
6041
|
noModel: true,
|
|
6008
6042
|
run: () => Promise.reject(/* @__PURE__ */ new Error("this import has no model")),
|
|
@@ -6500,6 +6534,6 @@ function limitAuthoringAgents(ctx, kindOf) {
|
|
|
6500
6534
|
return await next();
|
|
6501
6535
|
});
|
|
6502
6536
|
}
|
|
6503
|
-
export { checkWorld as $,
|
|
6537
|
+
export { checkWorld as $, authoredWorldOf as $t, loadWorldParts as A, lettersOf$1 as At, localChanges as B, commandVariable as Bt, cardChanges as C, loadDice as Ct, worldFieldChanges as D, parseCalendarFile as Dt, pictureChange as E, loadCalendar as Et, editsSince as F, cardTools as Ft, addressesToFetch as G, ImportCardError as Gt, writeOrigin as H, parseCommandsFile as Ht, writeSnapshot as I, entitiesByPiece as It, guardedLookup as J, pictureOf as Jt, candidateUrls as K, cardFormat as Kt, describeChanges as L, pieceFinder as Lt, CHECK_COMMANDS as M, UPDATE_FOLDER as Mt, CHECK_COMMAND_DESCRIPTIONS as N, baseId as Nt, editWorldInfo as O, CHARACTERS_DIR as Ot, recordProvenance as P, cardPieces as Pt, writePortrait as Q, DICE_RESULTS as Qt, hashWorld as R, readSource as Rt, addressChanges as S, DICE_FILE_NAME as St, matchPieces as T, CALENDAR_FILE_NAME as Tt, CatalogueError as U, TRIGGERS_FILE_NAME as Ut, readOrigin as V, loadCommands as Vt, addressKey as W, loadTriggers as Wt, vetUrl as X, DICE_COMPARISONS as Xt, mergeReports as Y, readCard as Yt, cardCharacter as Z, DICE_READINGS as Zt, structureImport as _, loadLocations as _t, beginImport as a, populateClock as at, CHECKS as b, FACTIONS_DIR as bt, importTextFor as c, populateItems as ct, knownOutputCeiling as d, populateLore as dt, authoringChatSessionId as en, loadValidatedWorld as et, importPhase as f, populateRoutines as ft, settleDraft as g, LOCATIONS_DIR as gt, markReady as h, routineProblems as ht, ImportState as i, populateCharacters as it, loadCardEvidence as j, shapeOpening as jt, readWorldInfo as k, loadCharacters as kt, importTools as l, populateKnowledge as lt, keepDraft as m, populateVariables as mt, limitAuthoringAgents as n, knowsCharacter as nt, contextOf as o, populateDice as ot, isReviewing as p, populateTriggers as pt, fetchPictures as q, isPng as qt, MAX_PREVIEW_TEXT as r, populateCalendar as rt, importHooks as s, populateFactions as st, AuthoringTools as t, withScratchStory as tt, worldOf as u, populateLocations as ut, checkImported as v, ITEMS_DIR as vt, diffText as w, parseDiceFile as wt, runChecks as x, loadFactions as xt, presentReport as y, loadItems as yt, isUnchanged as z, COMMANDS_FILE_NAME as zt };
|
|
6504
6538
|
|
|
6505
|
-
//# sourceMappingURL=authoring-tools-
|
|
6539
|
+
//# sourceMappingURL=authoring-tools-Bi9YQ9QH.js.map
|
package/lib/authoring.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { $ as checkWorld, A as loadWorldParts, At as lettersOf, C as cardChanges, D as worldFieldChanges, E as pictureChange, F as editsSince, Ft as cardTools, It as entitiesByPiece,
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
1
|
+
import { $ as checkWorld, $t as authoredWorldOf, A as loadWorldParts, At as lettersOf, C as cardChanges, D as worldFieldChanges, E as pictureChange, F as editsSince, Ft as cardTools, It as entitiesByPiece, M as CHECK_COMMANDS, Mt as UPDATE_FOLDER, N as CHECK_COMMAND_DESCRIPTIONS, O as editWorldInfo, Rt as readSource, S as addressChanges, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, b as CHECKS, j as loadCardEvidence, jt as shapeOpening, k as readWorldInfo, kt as loadCharacters, l as importTools, n as limitAuthoringAgents, o as contextOf, p as isReviewing, s as importHooks, u as worldOf, v as checkImported, w as diffText, x as runChecks, y as presentReport, zt as COMMANDS_FILE_NAME } from "./authoring-tools-Bi9YQ9QH.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-bZkxzRXJ.js";
|
|
3
3
|
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
4
|
-
import { B as deleteTriggerDocument, D as editWorldPlots, G as parseVariablesEdit, H as writeTriggerDocument, K as parseDiceEdit, M as readWorldEditor, O as editWorldRelation, Q as translateTools, U as parseCalendarEdit, V as readTriggerDocuments, X as presetTools, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, f as editCalendar, g as editVariables, i as checkWorldPack, l as deleteAuthoredEntity, m as editDice, nt as finishUpdate, o as listWorldPacks, p as editCommands, q as parseCommandsEdit, r as registerPackJail, rt as pendingUpdate, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument } from "./pack-jail-
|
|
4
|
+
import { B as deleteTriggerDocument, D as editWorldPlots, G as parseVariablesEdit, H as writeTriggerDocument, K as parseDiceEdit, M as readWorldEditor, O as editWorldRelation, Q as translateTools, U as parseCalendarEdit, V as readTriggerDocuments, X as presetTools, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, f as editCalendar, g as editVariables, i as checkWorldPack, l as deleteAuthoredEntity, m as editDice, nt as finishUpdate, o as listWorldPacks, p as editCommands, q as parseCommandsEdit, r as registerPackJail, rt as pendingUpdate, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument } from "./pack-jail-Y1XPbqHw.js";
|
|
5
|
+
import { Et as IMPORT_FOLDER, F as parseWorldInfoEdit, I as hasSpeech, Pt as InvalidEditProblems, R as partsText, at as writeWorldPrompt, it as readWorldPrompt, kt as PICTURE_FILE, nt as deleteWorldPrompt, qt as VARIABLES_FILE_NAME, rt as listWorldPrompts, tt as PROSE_PROMPTS, zt as parseRelationEdit } from "./serial-CS46qAvI.js";
|
|
6
|
+
import { B as parsePlotsFile, at as shippedPromptsDirectory, ht as registerCommands, q as formatIssue } from "./hooks-DR-HqE50.js";
|
|
5
7
|
import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { g as SURFACE_NAMES, m as PACK_LIMITS, p as PACK_ACTIONS } from "./packs-DD-v-Epl.js";
|
|
9
|
+
import { u as DEFAULT_SETTINGS } from "./narration-CUZIXzab.js";
|
|
10
|
+
import { r as childSampling } from "./child-Bfj7-Iuo.js";
|
|
11
|
+
import { a as updateImage, i as listGallery, n as describeGalleryImage } from "./gallery-BT5lf-T5.js";
|
|
12
|
+
import { n as interpretImage } from "./interpreter-BYNrjYZo.js";
|
|
9
13
|
import "./access-5vtPAT3O.js";
|
|
10
14
|
import { join, relative } from "node:path";
|
|
11
15
|
import { createHash } from "node:crypto";
|
|
@@ -66,13 +70,13 @@ async function writeWorldFile(world, kind, document, options = {}) {
|
|
|
66
70
|
await FILES[kind].write(world, document, options);
|
|
67
71
|
}
|
|
68
72
|
// src/host/authoring/read-tools.ts
|
|
69
|
-
const output$
|
|
73
|
+
const output$6 = (value) => [{
|
|
70
74
|
type: "text",
|
|
71
75
|
text: JSON.stringify(value, null, 2)
|
|
72
76
|
}];
|
|
73
|
-
const jsonOutput$
|
|
77
|
+
const jsonOutput$4 = {
|
|
74
78
|
schema: { type: "json" },
|
|
75
|
-
render: (_args, value) => output$
|
|
79
|
+
render: (_args, value) => output$6(value)
|
|
76
80
|
};
|
|
77
81
|
const keyParameter$1 = {
|
|
78
82
|
type: "string",
|
|
@@ -110,7 +114,7 @@ function listTool(reader, name, description, select, summarize) {
|
|
|
110
114
|
name,
|
|
111
115
|
description,
|
|
112
116
|
parameters: {},
|
|
113
|
-
output: jsonOutput$
|
|
117
|
+
output: jsonOutput$4,
|
|
114
118
|
isConcurrencySafe: () => true,
|
|
115
119
|
async execute(_args, exec) {
|
|
116
120
|
return json$1(select((await reader.read(exec)).state).map(summarize));
|
|
@@ -122,7 +126,7 @@ function getTool(reader, name, description, select) {
|
|
|
122
126
|
name,
|
|
123
127
|
description,
|
|
124
128
|
parameters: { key: keyParameter$1 },
|
|
125
|
-
output: jsonOutput$
|
|
129
|
+
output: jsonOutput$4,
|
|
126
130
|
isConcurrencySafe: () => true,
|
|
127
131
|
async execute(args, exec) {
|
|
128
132
|
const found = select((await reader.read(exec)).state).find((entry) => entry.key === args.key);
|
|
@@ -138,7 +142,7 @@ function authoredWorldReadTools(reader) {
|
|
|
138
142
|
name: "get_world_overview",
|
|
139
143
|
description: "Read the authored world’s top-level identity, description, rules, opening, tags, author and element counts.",
|
|
140
144
|
parameters: {},
|
|
141
|
-
output: jsonOutput$
|
|
145
|
+
output: jsonOutput$4,
|
|
142
146
|
isConcurrencySafe: () => true,
|
|
143
147
|
async execute(_args, exec) {
|
|
144
148
|
const { record, state } = await reader.read(exec);
|
|
@@ -167,7 +171,7 @@ function authoredWorldReadTools(reader) {
|
|
|
167
171
|
name: "get_world_info",
|
|
168
172
|
description: "Read what the world says about itself in world.json: name, description, tags, rules, the opening message and the alternate openings, author, version, time settings, and the preset, lorebooks, sampling and tool switches the person chose. edit_world_info changes the fields a card or an author is responsible for.",
|
|
169
173
|
parameters: {},
|
|
170
|
-
output: jsonOutput$
|
|
174
|
+
output: jsonOutput$4,
|
|
171
175
|
isConcurrencySafe: () => true,
|
|
172
176
|
async execute(_args, exec) {
|
|
173
177
|
return json$1(await readWorldInfo((await reader.read(exec)).record.directory));
|
|
@@ -228,7 +232,7 @@ function authoredWorldReadTools(reader) {
|
|
|
228
232
|
},
|
|
229
233
|
key: keyParameter$1
|
|
230
234
|
},
|
|
231
|
-
output: jsonOutput$
|
|
235
|
+
output: jsonOutput$4,
|
|
232
236
|
isConcurrencySafe: () => true,
|
|
233
237
|
async execute(args, exec) {
|
|
234
238
|
const { record } = await reader.read(exec);
|
|
@@ -265,7 +269,7 @@ function authoredWorldReadTools(reader) {
|
|
|
265
269
|
name: "get_world_trigger",
|
|
266
270
|
description: "Read the exact snake_case JSON document stored for one trigger in triggers.json. Use this before replacing a trigger.",
|
|
267
271
|
parameters: { key: keyParameter$1 },
|
|
268
|
-
output: jsonOutput$
|
|
272
|
+
output: jsonOutput$4,
|
|
269
273
|
isConcurrencySafe: () => true,
|
|
270
274
|
async execute(args, exec) {
|
|
271
275
|
const { record } = await reader.read(exec);
|
|
@@ -282,7 +286,7 @@ function authoredWorldReadTools(reader) {
|
|
|
282
286
|
required: true,
|
|
283
287
|
enum: WORLD_FILE_KINDS
|
|
284
288
|
} },
|
|
285
|
-
output: jsonOutput$
|
|
289
|
+
output: jsonOutput$4,
|
|
286
290
|
isConcurrencySafe: () => true,
|
|
287
291
|
async execute(args, exec) {
|
|
288
292
|
const { record } = await reader.read(exec);
|
|
@@ -313,7 +317,7 @@ function authoredWorldReadTools(reader) {
|
|
|
313
317
|
description: "Only edges whose target has this stable key."
|
|
314
318
|
}
|
|
315
319
|
},
|
|
316
|
-
output: jsonOutput$
|
|
320
|
+
output: jsonOutput$4,
|
|
317
321
|
isConcurrencySafe: () => true,
|
|
318
322
|
async execute(args, exec) {
|
|
319
323
|
return json$1((await reader.read(exec)).state.relations.filter((relation) => (args.kind === void 0 || relation.kind === args.kind) && (args.from === void 0 || relation.from.key === args.from) && (args.to === void 0 || relation.to.key === args.to)));
|
|
@@ -343,13 +347,13 @@ async function checkOpeningSpeakers(directory, edit) {
|
|
|
343
347
|
}
|
|
344
348
|
// src/host/authoring/pack-tools.ts
|
|
345
349
|
const PACK_MUTATION_TOOLS = ["delete_world_pack_file"];
|
|
346
|
-
const output$
|
|
350
|
+
const output$5 = (value) => [{
|
|
347
351
|
type: "text",
|
|
348
352
|
text: JSON.stringify(value, null, 2)
|
|
349
353
|
}];
|
|
350
|
-
const jsonOutput$
|
|
354
|
+
const jsonOutput$3 = {
|
|
351
355
|
schema: { type: "json" },
|
|
352
|
-
render: (_args, value) => output$
|
|
356
|
+
render: (_args, value) => output$5(value)
|
|
353
357
|
};
|
|
354
358
|
/** A path as the file tools take it: relative to the chat's folder when it has one, which is short and hard to mistype. */
|
|
355
359
|
function relativeTo(exec, path) {
|
|
@@ -361,7 +365,7 @@ const packParameter = {
|
|
|
361
365
|
required: true,
|
|
362
366
|
description: "The pack name (its folder under ui/), such as atlas."
|
|
363
367
|
};
|
|
364
|
-
const pathParameter = {
|
|
368
|
+
const pathParameter$1 = {
|
|
365
369
|
type: "string",
|
|
366
370
|
required: true,
|
|
367
371
|
description: "A path inside the pack with \"/\", such as pack.json or img/map.svg."
|
|
@@ -388,7 +392,7 @@ function worldPackTools(reader) {
|
|
|
388
392
|
name: "world_pack_guide",
|
|
389
393
|
description: "How to write an interface pack: where its files go (the folder is returned with the guide), the manifest, the skin, the surfaces, the rp object a surface gets, what it is told, and the limits. Read it before writing a pack.",
|
|
390
394
|
parameters: {},
|
|
391
|
-
output: jsonOutput$
|
|
395
|
+
output: jsonOutput$3,
|
|
392
396
|
isConcurrencySafe: () => true,
|
|
393
397
|
async execute(_args, exec) {
|
|
394
398
|
const { record } = await reader.read(exec);
|
|
@@ -403,7 +407,7 @@ function worldPackTools(reader) {
|
|
|
403
407
|
name: "list_world_packs",
|
|
404
408
|
description: "List the interface packs the world carries, their files and what is wrong with each. Each pack has a path: the folder its files go in, as the file tools take it.",
|
|
405
409
|
parameters: {},
|
|
406
|
-
output: jsonOutput$
|
|
410
|
+
output: jsonOutput$3,
|
|
407
411
|
isConcurrencySafe: () => true,
|
|
408
412
|
async execute(_args, exec) {
|
|
409
413
|
const { record } = await reader.read(exec);
|
|
@@ -417,7 +421,7 @@ function worldPackTools(reader) {
|
|
|
417
421
|
name: "check_world_pack",
|
|
418
422
|
description: "Check a pack of this world as session start will: the manifest, the theme, the skin, the surfaces and every file. An empty list of problems means it can be used.",
|
|
419
423
|
parameters: { pack: packParameter },
|
|
420
|
-
output: jsonOutput$
|
|
424
|
+
output: jsonOutput$3,
|
|
421
425
|
isConcurrencySafe: () => true,
|
|
422
426
|
async execute(args, exec) {
|
|
423
427
|
const { record } = await reader.read(exec);
|
|
@@ -432,9 +436,9 @@ function worldPackTools(reader) {
|
|
|
432
436
|
description: "Remove a file of a pack of this world; it is moved into the world's .trash directory. Requires user approval.",
|
|
433
437
|
parameters: {
|
|
434
438
|
pack: packParameter,
|
|
435
|
-
path: pathParameter
|
|
439
|
+
path: pathParameter$1
|
|
436
440
|
},
|
|
437
|
-
output: jsonOutput$
|
|
441
|
+
output: jsonOutput$3,
|
|
438
442
|
async execute(args, exec) {
|
|
439
443
|
const { record } = await reader.read(exec);
|
|
440
444
|
const { trashPath, problems } = await deleteWorldPackFile(record.directory, args.pack, args.path);
|
|
@@ -451,13 +455,13 @@ function worldPackTools(reader) {
|
|
|
451
455
|
}
|
|
452
456
|
// src/host/authoring/prompt-tools.ts
|
|
453
457
|
const PROMPT_MUTATION_TOOLS = ["write_world_prompt", "delete_world_prompt"];
|
|
454
|
-
const output$
|
|
458
|
+
const output$4 = (value) => [{
|
|
455
459
|
type: "text",
|
|
456
460
|
text: JSON.stringify(value, null, 2)
|
|
457
461
|
}];
|
|
458
|
-
const jsonOutput$
|
|
462
|
+
const jsonOutput$2 = {
|
|
459
463
|
schema: { type: "json" },
|
|
460
|
-
render: (_args, value) => output$
|
|
464
|
+
render: (_args, value) => output$4(value)
|
|
461
465
|
};
|
|
462
466
|
const idParameter = {
|
|
463
467
|
type: "string",
|
|
@@ -479,7 +483,7 @@ function worldPromptTools(reader, shipped = shippedPromptsDirectory()) {
|
|
|
479
483
|
name: "list_world_prompts",
|
|
480
484
|
description: "List the prompts the models are given, in a language, and whether this world carries its own version. \"prose\" prompts set how the story is written and how the models stay in character; \"rules\" prompts hold the rules of the game and the tools.",
|
|
481
485
|
parameters: { language: languageParameter },
|
|
482
|
-
output: jsonOutput$
|
|
486
|
+
output: jsonOutput$2,
|
|
483
487
|
isConcurrencySafe: () => true,
|
|
484
488
|
async execute(args, exec) {
|
|
485
489
|
const { record } = await reader.read(exec);
|
|
@@ -493,7 +497,7 @@ function worldPromptTools(reader, shipped = shippedPromptsDirectory()) {
|
|
|
493
497
|
id: idParameter,
|
|
494
498
|
language: languageParameter
|
|
495
499
|
},
|
|
496
|
-
output: jsonOutput$
|
|
500
|
+
output: jsonOutput$2,
|
|
497
501
|
isConcurrencySafe: () => true,
|
|
498
502
|
async execute(args, exec) {
|
|
499
503
|
const { record } = await reader.read(exec);
|
|
@@ -512,7 +516,7 @@ function worldPromptTools(reader, shipped = shippedPromptsDirectory()) {
|
|
|
512
516
|
description: "The complete prompt text."
|
|
513
517
|
}
|
|
514
518
|
},
|
|
515
|
-
output: jsonOutput$
|
|
519
|
+
output: jsonOutput$2,
|
|
516
520
|
async execute(args, exec) {
|
|
517
521
|
const { record } = await reader.read(exec);
|
|
518
522
|
await writeWorldPrompt(record.directory, args.language, args.id, args.text, shipped);
|
|
@@ -530,7 +534,7 @@ function worldPromptTools(reader, shipped = shippedPromptsDirectory()) {
|
|
|
530
534
|
id: idParameter,
|
|
531
535
|
language: languageParameter
|
|
532
536
|
},
|
|
533
|
-
output: jsonOutput$
|
|
537
|
+
output: jsonOutput$2,
|
|
534
538
|
async execute(args, exec) {
|
|
535
539
|
const { record } = await reader.read(exec);
|
|
536
540
|
const trashPath = await deleteWorldPrompt(record.directory, args.language, args.id, shipped);
|
|
@@ -544,6 +548,178 @@ function worldPromptTools(reader, shipped = shippedPromptsDirectory()) {
|
|
|
544
548
|
})
|
|
545
549
|
];
|
|
546
550
|
}
|
|
551
|
+
// src/host/authoring/image-tools.ts
|
|
552
|
+
const IMAGE_MUTATION_TOOLS = ["edit_world_image", "describe_world_image"];
|
|
553
|
+
const output$3 = (value) => [{
|
|
554
|
+
type: "text",
|
|
555
|
+
text: JSON.stringify(value, null, 2)
|
|
556
|
+
}];
|
|
557
|
+
const jsonOutput$1 = {
|
|
558
|
+
schema: { type: "json" },
|
|
559
|
+
render: (_args, value) => output$3(value)
|
|
560
|
+
};
|
|
561
|
+
const pathParameter = {
|
|
562
|
+
type: "string",
|
|
563
|
+
required: true,
|
|
564
|
+
description: "The path of the picture, exactly as list_world_images gives it (library/dock.png)."
|
|
565
|
+
};
|
|
566
|
+
const KINDS = [
|
|
567
|
+
"character",
|
|
568
|
+
"location",
|
|
569
|
+
"item"
|
|
570
|
+
];
|
|
571
|
+
/**
|
|
572
|
+
* Read, correct and describe the pictures of a world's library. A picture downloaded for a character card carries the addresses it came from and the card pieces that held
|
|
573
|
+
* them, so the assistant can read the card around an address (card_read) and say who a picture shows.
|
|
574
|
+
*/
|
|
575
|
+
function worldImageTools(reader, deps) {
|
|
576
|
+
return [
|
|
577
|
+
defineTool({
|
|
578
|
+
name: "list_world_images",
|
|
579
|
+
description: "List the pictures of the world's image library: each with its description, tags, the characters, places and things it shows, whether it may be shown again, and, for a picture downloaded for a character card, the addresses it came from with the ids of the card pieces that held each (read one with card_read to see the text around the address). A picture with no description has not been described yet.",
|
|
580
|
+
parameters: { undescribed: {
|
|
581
|
+
type: "boolean",
|
|
582
|
+
description: "Only the pictures that have no description yet."
|
|
583
|
+
} },
|
|
584
|
+
output: jsonOutput$1,
|
|
585
|
+
isConcurrencySafe: () => true,
|
|
586
|
+
async execute(args, exec) {
|
|
587
|
+
const { record } = await reader.read(exec);
|
|
588
|
+
const images = (await listGallery(record.directory)).filter((image) => image.unreadable !== true && (args.undescribed !== true || image.description === void 0));
|
|
589
|
+
return {
|
|
590
|
+
count: images.length,
|
|
591
|
+
images: images.map((image) => ({
|
|
592
|
+
path: image.path,
|
|
593
|
+
...image.description === void 0 ? {} : { description: image.description },
|
|
594
|
+
tags: image.tags,
|
|
595
|
+
subjects: image.subjects,
|
|
596
|
+
reusable: image.reusable,
|
|
597
|
+
...image.originalName === void 0 ? {} : { originalName: image.originalName },
|
|
598
|
+
...image.cardLinks === void 0 ? {} : { cardLinks: image.cardLinks }
|
|
599
|
+
}))
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
}),
|
|
603
|
+
defineTool({
|
|
604
|
+
name: "edit_world_image",
|
|
605
|
+
description: "Correct what a picture of the world's library says about itself: its description, tags, the characters, places and things it shows (by the exact names the world has) and whether it may be shown again. Give only what changes. Requires user approval.",
|
|
606
|
+
parameters: {
|
|
607
|
+
path: pathParameter,
|
|
608
|
+
description: {
|
|
609
|
+
type: "string",
|
|
610
|
+
description: "What the picture shows, in two to four plain sentences that stand on their own."
|
|
611
|
+
},
|
|
612
|
+
tags: {
|
|
613
|
+
type: "array",
|
|
614
|
+
items: { type: "string" },
|
|
615
|
+
description: "Short search words; replaces the tags the picture has."
|
|
616
|
+
},
|
|
617
|
+
subjects: {
|
|
618
|
+
type: "array",
|
|
619
|
+
items: {
|
|
620
|
+
type: "object",
|
|
621
|
+
additionalProperties: false,
|
|
622
|
+
properties: {
|
|
623
|
+
kind: {
|
|
624
|
+
type: "string",
|
|
625
|
+
required: true,
|
|
626
|
+
enum: [...KINDS]
|
|
627
|
+
},
|
|
628
|
+
name: {
|
|
629
|
+
type: "string",
|
|
630
|
+
required: true
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
description: "The characters, places and things the picture clearly shows; replaces the list it has. Leave out one you are not sure of."
|
|
635
|
+
},
|
|
636
|
+
reusable: {
|
|
637
|
+
type: "boolean",
|
|
638
|
+
description: "Whether a story may show the picture again in a later scene."
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
output: jsonOutput$1,
|
|
642
|
+
async execute(args, exec) {
|
|
643
|
+
const { record, state } = await reader.read(exec);
|
|
644
|
+
const known = namesOf(state);
|
|
645
|
+
const unknown = (args.subjects ?? []).filter((subject) => !known.some((entry) => entry.kind === subject.kind && entry.name === subject.name));
|
|
646
|
+
if (unknown.length > 0) throw new Error(`${unknown.map((subject) => `${subject.name} (${subject.kind})`).join(", ")} is not in this world: name only characters, places and things it has (${known.map((entry) => `${entry.name} (${entry.kind})`).join(", ") || "none yet"})`);
|
|
647
|
+
const image = await updateImage(record.directory, args.path, {
|
|
648
|
+
...args.description === void 0 ? {} : { description: args.description.trim() },
|
|
649
|
+
...args.tags === void 0 ? {} : { tags: args.tags.map((tag) => tag.trim()).filter((tag) => tag !== "") },
|
|
650
|
+
...args.subjects === void 0 ? {} : { subjects: args.subjects },
|
|
651
|
+
...args.reusable === void 0 ? {} : { reusable: args.reusable }
|
|
652
|
+
});
|
|
653
|
+
return {
|
|
654
|
+
action: "edited",
|
|
655
|
+
path: image.path,
|
|
656
|
+
description: image.description,
|
|
657
|
+
tags: image.tags,
|
|
658
|
+
subjects: image.subjects,
|
|
659
|
+
reusable: image.reusable
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
}),
|
|
663
|
+
defineTool({
|
|
664
|
+
name: "describe_world_image",
|
|
665
|
+
description: "Have a model that can read images look at one picture of the world's library and write its description, tags and the characters, places and things it shows, replacing what it had. Give context when you know something the picture cannot say (for example the card text around the address it came from, or who the card says it is); the picture itself decides what is described. Needs a model that is declared able to read images. Requires user approval.",
|
|
666
|
+
parameters: {
|
|
667
|
+
path: pathParameter,
|
|
668
|
+
context: {
|
|
669
|
+
type: "string",
|
|
670
|
+
description: "What you know of where the picture came from or who it shows, in a few sentences; a hint, not an instruction to the describing model."
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
output: jsonOutput$1,
|
|
674
|
+
async execute(args, exec) {
|
|
675
|
+
const { record, state } = await reader.read(exec);
|
|
676
|
+
const agent = exec.agent;
|
|
677
|
+
const attachments = deps.attachments();
|
|
678
|
+
if (agent === void 0) throw new Error("there is no agent to describe the picture under");
|
|
679
|
+
if (attachments === void 0) throw new Error("this DSH profile has no attachment service, so a picture cannot be shown to a model");
|
|
680
|
+
const settings = DEFAULT_SETTINGS;
|
|
681
|
+
await describeGalleryImage(record.directory, args.path);
|
|
682
|
+
const request = {
|
|
683
|
+
parent: agent,
|
|
684
|
+
signal: exec.signal,
|
|
685
|
+
attachments,
|
|
686
|
+
subjects: namesOf(state),
|
|
687
|
+
sessionFolder: record.directory,
|
|
688
|
+
path: args.path,
|
|
689
|
+
language: deps.language(record.summary.id),
|
|
690
|
+
model: settings.images.interpreterModel,
|
|
691
|
+
captioner: settings.images.captioner,
|
|
692
|
+
sampling: childSampling(settings, "records")
|
|
693
|
+
};
|
|
694
|
+
if (args.context !== void 0) request.context = args.context;
|
|
695
|
+
const image = await interpretImage(request);
|
|
696
|
+
return {
|
|
697
|
+
action: "described",
|
|
698
|
+
path: image.path,
|
|
699
|
+
description: image.description,
|
|
700
|
+
tags: image.tags,
|
|
701
|
+
subjects: image.subjects
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
})
|
|
705
|
+
];
|
|
706
|
+
}
|
|
707
|
+
function namesOf(state) {
|
|
708
|
+
return [
|
|
709
|
+
...state.characters.map((entry) => ({
|
|
710
|
+
kind: "character",
|
|
711
|
+
name: entry.name
|
|
712
|
+
})),
|
|
713
|
+
...state.places.map((entry) => ({
|
|
714
|
+
kind: "location",
|
|
715
|
+
name: entry.name
|
|
716
|
+
})),
|
|
717
|
+
...state.things.map((entry) => ({
|
|
718
|
+
kind: "item",
|
|
719
|
+
name: entry.name
|
|
720
|
+
}))
|
|
721
|
+
];
|
|
722
|
+
}
|
|
547
723
|
// src/host/authoring/approval-summary.ts
|
|
548
724
|
const MAX_FIELDS = 5;
|
|
549
725
|
function clip(value, max) {
|
|
@@ -658,7 +834,8 @@ const AUTHORING_MUTATION_TOOLS = /* @__PURE__ */ new Set([
|
|
|
658
834
|
"delete_world_trigger",
|
|
659
835
|
"write_world_file",
|
|
660
836
|
...PROMPT_MUTATION_TOOLS,
|
|
661
|
-
...PACK_MUTATION_TOOLS
|
|
837
|
+
...PACK_MUTATION_TOOLS,
|
|
838
|
+
...IMAGE_MUTATION_TOOLS
|
|
662
839
|
]);
|
|
663
840
|
function result(action, kind, key, state, extra = {}) {
|
|
664
841
|
return {
|
|
@@ -1028,6 +1205,18 @@ async function authoringApproval(exec, next, reviewing = () => Promise.resolve(f
|
|
|
1028
1205
|
}, remove ? void 0 : sizeOf(args["text"]))
|
|
1029
1206
|
};
|
|
1030
1207
|
}
|
|
1208
|
+
if (IMAGE_MUTATION_TOOLS.includes(exec.name)) {
|
|
1209
|
+
const describing = exec.name === "describe_world_image";
|
|
1210
|
+
const target = `picture “${String(args["path"])}”`;
|
|
1211
|
+
return {
|
|
1212
|
+
kind: "ask",
|
|
1213
|
+
reason: `${describing ? "have a model describe" : "change what is said about"} the authored world's ${target}`,
|
|
1214
|
+
displayReason: {
|
|
1215
|
+
en: `${describing ? "Have a model describe" : "Change the description, tags or subjects of"} the ${target}?`,
|
|
1216
|
+
zh: `${describing ? "让模型描述" : "修改"}${target.replace("picture", "图片")}${describing ? "" : "的描述、标签或主体"}?`
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1031
1220
|
if (exec.name === "reshape_opening") {
|
|
1032
1221
|
const target = String(args["target"]);
|
|
1033
1222
|
return {
|
|
@@ -1560,6 +1749,10 @@ function apply(ctx) {
|
|
|
1560
1749
|
for (const tool of authoredWorldWriteTools(reader)) ctx.tools.register(tool);
|
|
1561
1750
|
for (const tool of worldPromptTools(reader)) ctx.tools.register(tool);
|
|
1562
1751
|
for (const tool of worldPackTools(reader)) ctx.tools.register(tool);
|
|
1752
|
+
for (const tool of worldImageTools(reader, {
|
|
1753
|
+
language: (world) => ctx.roleplayAuthoringLanguages.get(world),
|
|
1754
|
+
attachments: () => ctx.get("attachments")
|
|
1755
|
+
})) ctx.tools.register(tool);
|
|
1563
1756
|
for (const tool of importTools(ctx.roleplayWorlds, () => ctx.roleplayImport.settings, prompting)) ctx.tools.register(tool);
|
|
1564
1757
|
for (const tool of cardTools(ctx.roleplayWorlds)) ctx.tools.register(tool);
|
|
1565
1758
|
for (const tool of updateTools(ctx.roleplayWorlds)) ctx.tools.register(tool);
|