@dsh-agentic-roleplay/core 0.10.2 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{access-CXtaZNbx.js → access-Md1YTSX1.js} +4 -1
- package/lib/{authoring-tools-C9cmcUbD.js → authoring-tools-BFdw7ahj.js} +72 -9
- package/lib/authoring.js +38 -8
- package/lib/client.js +777 -427
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -2
- package/lib/doctor.js +3 -3
- package/lib/{gallery-CtG-bDzz.js → gallery-BWHmjogd.js} +3 -3
- package/lib/{generator-nLoPM5MF.js → generator-QCdm8nUh.js} +9 -3
- package/lib/helper.js +9 -0
- package/lib/{hooks-BpLN_hhT.js → hooks-C2U1-8ur.js} +709 -67
- package/lib/images.js +4 -4
- package/lib/index.js +225 -19
- package/lib/{library-CH-ahlm0.js → library-4zmCAshR.js} +3 -3
- package/lib/{lorebook-author-tools-Cg7QQemi.js → lorebook-author-tools-Bjfjt3bg.js} +7 -7
- package/lib/lorebook-authoring.js +4 -4
- package/lib/{narration-B0hConSw.js → narration-b_VBEUWn.js} +7 -3
- package/lib/orchestration.js +338 -28
- package/lib/{pack-jail-D5j5mIq6.js → pack-jail-Ci9bIeDI.js} +25 -15
- package/lib/{packs-Cc05FrId.js → packs-CYkozh8Q.js} +2 -2
- package/lib/{presenter-agent-UKbKYXMO.js → presenter-agent-CqkAL03Q.js} +10 -7
- package/lib/{preset-Be4lz6vB.js → preset-B-35yUmt.js} +3 -3
- package/lib/{preset-author-tools-C3s0iSfv.js → preset-author-tools-BUymqZM5.js} +7 -7
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-Cl9sU3Qs.js → presets-_U-xroo0.js} +27 -8
- package/lib/{reflection-I9z-PvFK.js → reflection-B9N0z3KY.js} +9 -608
- package/lib/{text-CzqhC8sT.js → text-C2AGl7Je.js} +11 -2
- package/lib/{turn-guard-B9pGCeir.js → turn-guard-C0M3rXEN.js} +10 -10
- package/package.json +33 -32
- package/prompts/en/import/variables.md +1 -0
- package/prompts/en/roleplay/character-decide.md +1 -1
- package/prompts/en/roleplay/decide-reuse.md +3 -0
- package/prompts/en/roleplay/decide-variable.md +1 -0
- package/prompts/en/roleplay/image-presenter.md +1 -0
- package/prompts/en/roleplay/track-values.md +1 -0
- package/prompts/en/roleplay/track-variables.md +1 -0
- package/prompts/zh/import/variables.md +1 -0
- package/prompts/zh/roleplay/character-decide.md +1 -1
- package/prompts/zh/roleplay/decide-reuse.md +3 -0
- package/prompts/zh/roleplay/decide-variable.md +1 -0
- package/prompts/zh/roleplay/image-presenter.md +1 -0
- package/prompts/zh/roleplay/track-values.md +1 -0
- package/prompts/zh/roleplay/track-variables.md +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as atomicWrite, t as promptFor } from "./access-
|
|
1
|
+
import { n as atomicWrite, t as promptFor } from "./access-Md1YTSX1.js";
|
|
2
2
|
import { l as runChild } from "./child-C9nPIy9j.js";
|
|
3
|
-
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-
|
|
4
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
5
|
-
import { c as nextSceneSerial, u as referenceImagePath } from "./library-
|
|
3
|
+
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-QCdm8nUh.js";
|
|
4
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BWHmjogd.js";
|
|
5
|
+
import { c as nextSceneSerial, u as referenceImagePath } from "./library-4zmCAshR.js";
|
|
6
6
|
import { join, relative } from "node:path";
|
|
7
7
|
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -390,7 +390,7 @@ function imageTools(deps) {
|
|
|
390
390
|
negative_tags: {
|
|
391
391
|
...stringList,
|
|
392
392
|
required: true,
|
|
393
|
-
description: "
|
|
393
|
+
description: "What the picture must not show for this entity: its opposites and the drift a model tends to make (a different build, hair colour, age, style). Never a trait it has, and never an expression, pose or action."
|
|
394
394
|
},
|
|
395
395
|
global_id: {
|
|
396
396
|
type: "string",
|
|
@@ -403,6 +403,9 @@ function imageTools(deps) {
|
|
|
403
403
|
},
|
|
404
404
|
execute(args) {
|
|
405
405
|
const subject = findSubject(deps.story, args.kind, args.key);
|
|
406
|
+
const own = new Set(args.tags.map((tag) => tag.trim().toLowerCase()));
|
|
407
|
+
const contradicting = args.negative_tags.filter((tag) => own.has(tag.trim().toLowerCase()));
|
|
408
|
+
if (contradicting.length > 0) throw new Error(`${contradicting.map((tag) => `"${tag}"`).join(", ")} ${contradicting.length === 1 ? "is" : "are"} also in tags: a trait the entity has cannot be one to avoid. Leave ${contradicting.length === 1 ? "it" : "them"} out of negative_tags, or out of tags if it is not stable.`);
|
|
406
409
|
const identity = deps.story.visualIdentities.set(subject.kind, subject.id, {
|
|
407
410
|
description: args.description,
|
|
408
411
|
tags: args.tags,
|
|
@@ -839,6 +842,6 @@ async function runImagePresenter(job) {
|
|
|
839
842
|
images: [...generated]
|
|
840
843
|
};
|
|
841
844
|
}
|
|
842
|
-
export {
|
|
845
|
+
export { searchImages as a, presentedFor as c, findImages as i, interpretImage as n, tokensOf as o, imageTools as r, present as s, runImagePresenter as t };
|
|
843
846
|
|
|
844
|
-
//# sourceMappingURL=presenter-agent-
|
|
847
|
+
//# sourceMappingURL=presenter-agent-CqkAL03Q.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools-
|
|
1
|
+
import { r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools-BFdw7ahj.js";
|
|
2
2
|
import { u as SAMPLING_RANGES } from "./child-C9nPIy9j.js";
|
|
3
|
-
import { Y as cleanText } from "./presets-
|
|
3
|
+
import { Y as cleanText } from "./presets-_U-xroo0.js";
|
|
4
4
|
// src/host/import/preset.ts
|
|
5
5
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
6
6
|
const LEGACY_KEYS = [
|
|
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
239
239
|
}
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-B-35yUmt.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./access-
|
|
2
|
-
import { $ as IMPORT_FOLDER, G as deleteWorldPrompt, J as writeWorldPrompt, K as listWorldPrompts, Q as withPlayer, W as PROSE_PROMPTS, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as readWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import { i as contextOf } from "./authoring-tools-
|
|
5
|
-
import { i as translator, r as languageOf } from "./text-
|
|
6
|
-
import {
|
|
1
|
+
import "./access-Md1YTSX1.js";
|
|
2
|
+
import { $ as IMPORT_FOLDER, G as deleteWorldPrompt, J as writeWorldPrompt, K as listWorldPrompts, Q as withPlayer, W as PROSE_PROMPTS, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as readWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-_U-xroo0.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-B-35yUmt.js";
|
|
4
|
+
import { i as contextOf } from "./authoring-tools-BFdw7ahj.js";
|
|
5
|
+
import { i as translator, r as languageOf } from "./text-C2AGl7Je.js";
|
|
6
|
+
import { et as languageOf$1, it as shippedPromptsDirectory, rt as shippedLanguages } from "./hooks-C2U1-8ur.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -278,4 +278,4 @@ async function presetApproval(exec, next, carries) {
|
|
|
278
278
|
}
|
|
279
279
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
280
280
|
|
|
281
|
-
//# sourceMappingURL=preset-author-tools-
|
|
281
|
+
//# sourceMappingURL=preset-author-tools-BUymqZM5.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-
|
|
4
|
-
import "./hooks-
|
|
5
|
-
import { c as presetDirectory } from "./presets-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-BFdw7ahj.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-C0M3rXEN.js";
|
|
3
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BUymqZM5.js";
|
|
4
|
+
import "./hooks-C2U1-8ur.js";
|
|
5
|
+
import { c as presetDirectory } from "./presets-_U-xroo0.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
// src/preset-authoring.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-
|
|
2
|
-
import "./narration-
|
|
3
|
-
import {
|
|
4
|
-
import { i as translator, r as languageOf$1 } from "./text-
|
|
1
|
+
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-Md1YTSX1.js";
|
|
2
|
+
import "./narration-b_VBEUWn.js";
|
|
3
|
+
import { G as readDocument, J as errorMessage, K as Reader, X as PROMPTS_FOLDER, Y as LANGUAGE_FOLDER, et as languageOf, it as shippedPromptsDirectory, nt as promptProblem, q as formatIssue, rt as shippedLanguages, tt as listFiles } from "./hooks-C2U1-8ur.js";
|
|
4
|
+
import { i as translator, r as languageOf$1 } from "./text-C2AGl7Je.js";
|
|
5
5
|
import { d as parseSampling } from "./child-C9nPIy9j.js";
|
|
6
|
-
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-
|
|
6
|
+
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-4zmCAshR.js";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, valueIssue } from "@dsh-agentic-roleplay/state";
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
@@ -151,6 +151,18 @@ const LORE_SUBJECT_KINDS = [
|
|
|
151
151
|
"item",
|
|
152
152
|
"lore"
|
|
153
153
|
];
|
|
154
|
+
// src/host/residency/guard.ts
|
|
155
|
+
/** The same service, whose listed methods first make room for the model they use and keep it from being unloaded while they run. */
|
|
156
|
+
function guarded(residency, role, service, methods) {
|
|
157
|
+
if (residency === void 0 || service === void 0) return service;
|
|
158
|
+
return new Proxy(service, { get(target, property, receiver) {
|
|
159
|
+
const value = Reflect.get(target, property, receiver);
|
|
160
|
+
if (typeof value !== "function") return value;
|
|
161
|
+
const call = value;
|
|
162
|
+
if (typeof property === "string" && methods.includes(property)) return (...args) => residency.run(role, async () => await call.apply(target, args));
|
|
163
|
+
return call.bind(target);
|
|
164
|
+
} });
|
|
165
|
+
}
|
|
154
166
|
// src/shared/world-state.ts
|
|
155
167
|
/** The problems with an edit, for the person who made it; nothing was changed. */
|
|
156
168
|
var InvalidEditProblems = class extends Error {
|
|
@@ -674,7 +686,7 @@ function parseRelationEdit(value) {
|
|
|
674
686
|
if (typeof input["status"] !== "string" || !choices.includes(input["status"])) problems.push(`status must be one of: ${choices.join(", ")}`);
|
|
675
687
|
}
|
|
676
688
|
if (creating) {
|
|
677
|
-
for (const field of ["from", "to"]) if (typeof input[field] !== "string" || input[field].trim() === "") problems.push(`${field} is needed`);
|
|
689
|
+
for (const field of ["from", "to"]) if (typeof input[field] !== "string" || input[field].trim() === "") problems.push(`${field} is needed: the key of the entity, written as plain text and not as an object`);
|
|
678
690
|
if ((kind === "character" || kind === "social") && (typeof input["label"] !== "string" || input["label"].trim() === "")) problems.push("label is needed");
|
|
679
691
|
if (kind === "membership" && (typeof input["role"] !== "string" || input["role"].trim() === "")) problems.push("role is needed");
|
|
680
692
|
if (kind === "exit" && typeof input["description"] !== "string") problems.push("description is needed");
|
|
@@ -1390,6 +1402,7 @@ function readDefinition(reader) {
|
|
|
1390
1402
|
subject,
|
|
1391
1403
|
visibility,
|
|
1392
1404
|
...reader.raw("description") === void 0 ? {} : { description: reader.text("description") },
|
|
1405
|
+
...reader.raw("update") === void 0 ? {} : { update: reader.text("update") },
|
|
1393
1406
|
only,
|
|
1394
1407
|
options,
|
|
1395
1408
|
bands,
|
|
@@ -3655,6 +3668,10 @@ const VARIABLES_SCHEMA = {
|
|
|
3655
3668
|
type: "string",
|
|
3656
3669
|
description: "What it measures, in a sentence."
|
|
3657
3670
|
},
|
|
3671
|
+
update: {
|
|
3672
|
+
type: "string",
|
|
3673
|
+
description: "When and how the card says it changes (its update rule: what makes it rise or fall, and by how much), in a sentence or two; empty when the card gives no rule."
|
|
3674
|
+
},
|
|
3658
3675
|
kind: {
|
|
3659
3676
|
type: "string",
|
|
3660
3677
|
enum: [
|
|
@@ -3727,6 +3744,7 @@ const VARIABLES_SCHEMA = {
|
|
|
3727
3744
|
"key",
|
|
3728
3745
|
"name",
|
|
3729
3746
|
"description",
|
|
3747
|
+
"update",
|
|
3730
3748
|
"kind",
|
|
3731
3749
|
"subject",
|
|
3732
3750
|
"visibility",
|
|
@@ -3773,6 +3791,7 @@ function variableDocuments(answer, roster) {
|
|
|
3773
3791
|
subject: text(entry["subject"])
|
|
3774
3792
|
};
|
|
3775
3793
|
put(document, "description", text(entry["description"]));
|
|
3794
|
+
put(document, "update", text(entry["update"]));
|
|
3776
3795
|
put(document, "visibility", text(entry["visibility"]));
|
|
3777
3796
|
put(document, "only", list(entry["only"]).flatMap((name) => keyOf(name) ?? []));
|
|
3778
3797
|
for (const field of ["min", "max"]) if (typeof entry[field] === "number") document[field] = entry[field];
|
|
@@ -4145,6 +4164,6 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
|
|
|
4145
4164
|
});
|
|
4146
4165
|
}
|
|
4147
4166
|
}
|
|
4148
|
-
export { IMPORT_FOLDER as $, sourcesFor as A, InvalidEditProblems as At, modeFor as B,
|
|
4167
|
+
export { IMPORT_FOLDER as $, sourcesFor as A, InvalidEditProblems as At, modeFor as B, WEEKDAY_NAMES as Bt, inert as C, parseSlotsFile as Ct, pruneLoreSubjects as D, parseCharacterFile as Dt, pruneLinks as E, CHARACTER_FILE_NAME as Et, ROLE_TABLE as F, parseRelationEdit as Ft, deleteWorldPrompt as G, routeVerdicts as H, INTENT_STATUSES as Ht, isLeftOut as I, parseThingEdit as It, writeWorldPrompt as J, listWorldPrompts as K, announceProblem as L, guarded as Lt, classifyItems as M, parseFactionEdit as Mt, findEntity as N, parseLoreEdit as Nt, pruneMembers as O, readVariableValues as Ot, ROLES as P, parsePlaceEdit as Pt, withPlayer as Q, askYesNo as R, LORE_KINDS as Rt, extractVariables as S, parseItemFile as St, pruneKnowledge as T, parseFactionFile as Tt, yesAt as U, noAt as V, DEFAULT_SLOTS as Vt, PROSE_PROMPTS as W, itemise as X, cleanText as Y, partsOf as Z, characterDocument as _, parseLoreFile as _t, isPresetName as a, readImportFolder as at, extractStyle as b, ITEM_FILE_NAME as bt, presetDirectory as c, sourceSummary as ct, savePresetFromWorld as d, parseAuthoringCommand as dt, ImportNotFoundError as et, sha as f, VARIABLES_FILE_NAME as ft, asWritten as g, LORE_FILE_NAME as gt, addLore as h, variableProblems as ht, deletePreset as i, parseChoices as it, buildRoster as j, parseCharacterEdit as jt, pruneRelationships as k, readIdentifier as kt, readPreset as l, IMPORT_COMMAND as lt, STANDING_PROMPT as m, parseVariablesFile as mt, createPresetFromGuidance as n, PICTURE_FILE as nt, listPresets as o, writeChoices as ot, updatePresetInfo as p, loadVariables as pt, readWorldPrompt as q, createPresetFromShipped as r, openingText as rt, loadPreset as s, dialectOf as st, PRESET_FILE as t, ImportStore as tt, reservePreset as u, parseImportCommand as ut, emptyExtracted as v, LOCATION_FILE_NAME as vt, loreDocuments as w, FACTION_FILE_NAME as wt, extractStyleFrom as x, SLOTS_FILE_NAME as xt, extractEntities as y, parseLocationFile as yt, mergeReports as z, LORE_SCOPES as zt };
|
|
4149
4168
|
|
|
4150
|
-
//# sourceMappingURL=presets-
|
|
4169
|
+
//# sourceMappingURL=presets-_U-xroo0.js.map
|