@dsh-agentic-roleplay/core 0.11.0 → 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--6V1pIIL.js → authoring-tools-BFdw7ahj.js} +72 -9
- package/lib/authoring.js +38 -8
- package/lib/client.js +761 -411
- 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-DORky4KT.js → hooks-C2U1-8ur.js} +676 -15
- 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-BrVde1N-.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-Bk82pX9t.js → pack-jail-Ci9bIeDI.js} +17 -14
- package/lib/{packs-ELfh8yh1.js → packs-CYkozh8Q.js} +2 -2
- package/lib/{presenter-agent-UKbKYXMO.js → presenter-agent-CqkAL03Q.js} +10 -7
- package/lib/{preset-D9Sfc8sf.js → preset-B-35yUmt.js} +3 -3
- package/lib/{preset-author-tools-B3pFL1-e.js → preset-author-tools-BUymqZM5.js} +7 -7
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-BRt4Xsy4.js → presets-_U-xroo0.js} +27 -8
- package/lib/{reflection-CHiHsY4Y.js → reflection-B9N0z3KY.js} +9 -608
- package/lib/{text-CzqhC8sT.js → text-C2AGl7Je.js} +11 -2
- package/lib/{turn-guard-B53qOWEU.js → turn-guard-C0M3rXEN.js} +2 -2
- package/package.json +2 -2
- 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
package/lib/compaction.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as liveSettings, t as decodeOutput } from "./narration-
|
|
2
|
-
import { l as roleplaySessionOf, t as promptFor } from "./access-
|
|
1
|
+
import { a as liveSettings, t as decodeOutput } from "./narration-b_VBEUWn.js";
|
|
2
|
+
import { l as roleplaySessionOf, t as promptFor } from "./access-Md1YTSX1.js";
|
|
3
3
|
import { E as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { sessionFolder } from "@dsh-agentic-roleplay/state";
|
package/lib/doctor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as chatSessionId } from "./access-
|
|
1
|
+
import { c as chatSessionId } from "./access-Md1YTSX1.js";
|
|
2
2
|
import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
|
|
3
|
-
import { i as externalTools, t as externalToolLimit } from "./hooks-
|
|
4
|
-
import { a as liveSettings } from "./narration-
|
|
3
|
+
import { i as externalTools, t as externalToolLimit } from "./hooks-C2U1-8ur.js";
|
|
4
|
+
import { a as liveSettings } from "./narration-b_VBEUWn.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as atomicWrite } from "./access-
|
|
2
|
-
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-
|
|
1
|
+
import { n as atomicWrite } from "./access-Md1YTSX1.js";
|
|
2
|
+
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-4zmCAshR.js";
|
|
3
3
|
import { join, sep } from "node:path";
|
|
4
4
|
import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
5
5
|
// src/host/images/gallery.ts
|
|
@@ -187,4 +187,4 @@ async function updateImage(sessionFolder, path, update) {
|
|
|
187
187
|
}
|
|
188
188
|
export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
|
|
189
189
|
|
|
190
|
-
//# sourceMappingURL=gallery-
|
|
190
|
+
//# sourceMappingURL=gallery-BWHmjogd.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-
|
|
1
|
+
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-4zmCAshR.js";
|
|
2
2
|
// src/host/images/generator.ts
|
|
3
3
|
const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
4
4
|
/** What a reference image shows: the subject and its stable look. */
|
|
@@ -23,6 +23,12 @@ function referencePrompt(request) {
|
|
|
23
23
|
identity.negativeTags.length === 0 ? void 0 : `Avoid: ${identity.negativeTags.join(", ")}.`
|
|
24
24
|
]);
|
|
25
25
|
}
|
|
26
|
+
/** What one subject must not look like may well be what another in the same picture does look like, so a trait that any subject has is not avoided. */
|
|
27
|
+
function avoidedIn(subjects) {
|
|
28
|
+
const wanted = new Set(subjects.flatMap((subject) => subject.identity.tags.map((tag) => tag.trim().toLowerCase())));
|
|
29
|
+
const avoided = [...new Set(subjects.flatMap((subject) => subject.identity.negativeTags))].filter((tag) => !wanted.has(tag.trim().toLowerCase()));
|
|
30
|
+
return avoided.length === 0 ? void 0 : `Avoid: ${avoided.join(", ")}.`;
|
|
31
|
+
}
|
|
26
32
|
function transientPrompt(request) {
|
|
27
33
|
return lines([
|
|
28
34
|
request.artDirection,
|
|
@@ -33,7 +39,7 @@ function transientPrompt(request) {
|
|
|
33
39
|
subject.transient === "" ? void 0 : `Current visible state: ${subject.transient}`
|
|
34
40
|
])),
|
|
35
41
|
"Preserve every canonical identity. Depict only the stated subjects, state and action; do not invent story facts.",
|
|
36
|
-
|
|
42
|
+
avoidedIn(request.subjects)
|
|
37
43
|
]);
|
|
38
44
|
}
|
|
39
45
|
async function firstPng(service, prompt, options = {}) {
|
|
@@ -141,4 +147,4 @@ async function generateTransientImage(service, request) {
|
|
|
141
147
|
}
|
|
142
148
|
export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
|
|
143
149
|
|
|
144
|
-
//# sourceMappingURL=generator-
|
|
150
|
+
//# sourceMappingURL=generator-QCdm8nUh.js.map
|
package/lib/helper.js
CHANGED
|
@@ -26,6 +26,15 @@ function apply(ctx) {
|
|
|
26
26
|
ctx.on("agent/created", ({ agent }) => {
|
|
27
27
|
helpers.get(agent.session.id)?.setup(agent);
|
|
28
28
|
});
|
|
29
|
+
ctx.on("agent/pre-step", async (payload, next) => {
|
|
30
|
+
const decision = await next();
|
|
31
|
+
const selected = payload.agent.model.current();
|
|
32
|
+
if (decision.kind === "enter") await ctx.get("roleplayOrchestration")?.residency?.ensure("main", selected === void 0 ? void 0 : {
|
|
33
|
+
provider: selected.provider,
|
|
34
|
+
model: selected.model
|
|
35
|
+
});
|
|
36
|
+
return decision;
|
|
37
|
+
});
|
|
29
38
|
}
|
|
30
39
|
export { apply, inject, name };
|
|
31
40
|
|