@dsh-agentic-roleplay/core 0.7.3 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{access-DtOxFKBK.js → access-CfQWbNZP.js} +4 -7
- package/lib/authoring-tools-BgmC2oqU.js +3691 -0
- package/lib/authoring.js +59 -24
- package/lib/{child-CyCViUKa.js → child-lYYeOwl2.js} +147 -46
- package/lib/client.js +931 -860
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +8 -13
- package/lib/{doctor-chat-ByDfCMeo.js → doctor-chat-hL1a61hp.js} +2 -3
- package/lib/doctor.js +6 -8
- package/lib/{gallery-DmBZ2L5l.js → gallery-D1V4h8vh.js} +3 -4
- package/lib/{generator-BmdoTIL2.js → generator-CLPosooC.js} +3 -4
- package/lib/helper.js +2 -3
- package/lib/{hooks-C8eELrni.js → hooks-rQTTeOC4.js} +144 -88
- package/lib/images.js +4 -4
- package/lib/index.js +1024 -913
- package/lib/{library-lVNf9qG_.js → library-Dfu0dgRj.js} +32 -21
- package/lib/{lorebook-author-tools-BDOs4i5C.js → lorebook-author-tools-BAaAqZZm.js} +11 -14
- package/lib/lorebook-authoring.js +5 -6
- package/lib/{narration-DvFBqmqe.js → narration-CjB_KwwY.js} +58 -20
- package/lib/orchestration.js +138 -72
- package/lib/{pack-jail-DeTscGT2.js → pack-jail-CN-314ln.js} +94 -137
- package/lib/{packs-CY8ms8v_.js → packs-DIj5BEfq.js} +6 -10
- package/lib/{presenter-agent-cFR4sos3.js → presenter-agent-DR0KvLE0.js} +13 -19
- package/lib/{preset-n4-j6k4S.js → preset-CscHj1-Y.js} +5 -5
- package/lib/{preset-author-tools-2m4BLtws.js → preset-author-tools-CxluF8qc.js} +13 -15
- package/lib/preset-authoring.js +6 -7
- package/lib/presets-HB8kJTaE.js +3993 -0
- package/lib/{reflection-CJB5s0ip.js → reflection-Dg1xtOTW.js} +137 -148
- package/lib/{text-Cwl5s0j0.js → text-DyRN4nDP.js} +13 -7
- package/lib/{turn-guard-BvCs1VxB.js → turn-guard-g_hDn0jR.js} +6 -7
- package/package.json +29 -29
- package/prompts/en/import/casting.md +14 -0
- package/prompts/en/import/character.md +1 -0
- package/prompts/en/import/classifier.md +9 -0
- package/prompts/en/import/finish-draft.md +1 -0
- package/prompts/en/import/generator.md +8 -0
- package/prompts/en/import/notice-repair.md +4 -0
- package/prompts/en/import/repair-again.md +3 -0
- package/prompts/en/import/roster.md +1 -0
- package/prompts/en/import/variables.md +1 -0
- package/prompts/en/roleplay/game-master.md +3 -0
- package/prompts/en/roleplay/standing.md +1 -0
- package/prompts/en/world/author.md +1 -1
- package/prompts/zh/import/casting.md +14 -0
- package/prompts/zh/import/character.md +1 -0
- package/prompts/zh/import/classifier.md +9 -0
- package/prompts/zh/import/finish-draft.md +1 -0
- package/prompts/zh/import/generator.md +8 -0
- package/prompts/zh/import/notice-repair.md +4 -0
- package/prompts/zh/import/repair-again.md +3 -0
- package/prompts/zh/import/roster.md +1 -0
- package/prompts/zh/import/variables.md +1 -0
- package/prompts/zh/roleplay/game-master.md +3 -0
- package/prompts/zh/roleplay/standing.md +1 -0
- package/prompts/zh/world/author.md +1 -1
- package/lib/authoring-tools-CIsWbq0B.js +0 -6317
- package/lib/route-C6SHz9j2.js +0 -518
package/lib/compaction.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as runChild, n as childModel, r as childSampling, y as tokensOf } from "./child-
|
|
1
|
+
import { a as liveSettings, t as decodeOutput } from "./narration-CjB_KwwY.js";
|
|
2
|
+
import { o as roleplaySessionOf, t as promptFor } from "./access-CfQWbNZP.js";
|
|
3
|
+
import { c as runChild, n as childModel, r as childSampling, y as tokensOf } from "./child-lYYeOwl2.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
6
6
|
import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
|
7
|
-
|
|
7
|
+
// src/host/compaction/chronicle.ts
|
|
8
8
|
const CJK = /\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}/gu;
|
|
9
9
|
/** A rough size of a text in tokens: scripts written without spaces are denser than the rest. */
|
|
10
10
|
function estimateTokens(text) {
|
|
@@ -127,8 +127,7 @@ function composeSummary(story) {
|
|
|
127
127
|
const digests = story.summaries.list("digest");
|
|
128
128
|
return [chapters.length === 0 ? "" : `Story so far (long term):\n${chapters.map((summary) => `${span(summary)}: ${summary.text}`).join("\n\n")}`, digests.length === 0 ? "" : `Recently (short term):\n${digests.map((summary) => `${span(summary)}: ${summary.text}`).join("\n\n")}`].filter((part) => part !== "").join("\n\n");
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
//#region src/host/compaction/chronicler.ts
|
|
130
|
+
// src/host/compaction/chronicler.ts
|
|
132
131
|
const SUMMARY_SCHEMA = {
|
|
133
132
|
type: "object",
|
|
134
133
|
properties: { summary: {
|
|
@@ -157,8 +156,7 @@ function childChronicler(parent, settings) {
|
|
|
157
156
|
})).summary;
|
|
158
157
|
} };
|
|
159
158
|
}
|
|
160
|
-
|
|
161
|
-
//#region src/host/compaction/range.ts
|
|
159
|
+
// src/host/compaction/range.ts
|
|
162
160
|
/** The turn each event belongs to: the latest turn that had started by then. */
|
|
163
161
|
function turnsOf(events) {
|
|
164
162
|
const turns = /* @__PURE__ */ new Map();
|
|
@@ -200,8 +198,7 @@ function selectFoldRange(input) {
|
|
|
200
198
|
}
|
|
201
199
|
return null;
|
|
202
200
|
}
|
|
203
|
-
|
|
204
|
-
//#region src/host/compaction/engine.ts
|
|
201
|
+
// src/host/compaction/engine.ts
|
|
205
202
|
/** Folding more often than this size is pointless, whatever the window. */
|
|
206
203
|
const MIN_LIMIT = 4e3;
|
|
207
204
|
const textOf = (content) => content.flatMap((block) => block.type === "text" ? [block.text] : []).join("\n");
|
|
@@ -318,10 +315,8 @@ var RoleplayCompaction = class extends BasicCompactionEngine {
|
|
|
318
315
|
};
|
|
319
316
|
}
|
|
320
317
|
};
|
|
321
|
-
|
|
322
|
-
//#region src/compaction.ts
|
|
318
|
+
// src/compaction.ts
|
|
323
319
|
const name = "@dsh-agentic-roleplay/core/compaction";
|
|
324
|
-
//#endregion
|
|
325
320
|
export { RoleplayCompaction, RoleplayCompaction as default, name };
|
|
326
321
|
|
|
327
322
|
//# sourceMappingURL=compaction.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shared/doctor-chat.ts
|
|
2
2
|
const PREFIX = "doctor-";
|
|
3
3
|
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
4
4
|
/** Stable DSH chat identity for the session doctor of one roleplay session. */
|
|
@@ -11,7 +11,6 @@ function doctorSessionOf(chat) {
|
|
|
11
11
|
const id = chat.slice(7);
|
|
12
12
|
return UUID_V4.test(id) ? id : void 0;
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { doctorSessionOf as n, doctorChatSessionId as t };
|
|
16
15
|
|
|
17
|
-
//# sourceMappingURL=doctor-chat-
|
|
16
|
+
//# sourceMappingURL=doctor-chat-hL1a61hp.js.map
|
package/lib/doctor.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as chatSessionId } from "./access-
|
|
2
|
-
import {
|
|
3
|
-
import { i as externalTools, t as externalToolLimit } from "./hooks-
|
|
4
|
-
import {
|
|
1
|
+
import { a as chatSessionId } from "./access-CfQWbNZP.js";
|
|
2
|
+
import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
|
|
3
|
+
import { i as externalTools, t as externalToolLimit } from "./hooks-rQTTeOC4.js";
|
|
4
|
+
import { a as liveSettings } from "./narration-CjB_KwwY.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
8
8
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
9
9
|
import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
10
|
-
|
|
10
|
+
// src/host/agent/doctor-undo.ts
|
|
11
11
|
const UNDO_SNAPSHOT = "doctor-undo";
|
|
12
12
|
const UNDO_KEY = "doctor.undo";
|
|
13
13
|
var UndoRefusedError = class extends Error {};
|
|
@@ -34,8 +34,7 @@ async function undoLastEdit(deps, id) {
|
|
|
34
34
|
deps.state.restore(dir, id, UNDO_SNAPSHOT);
|
|
35
35
|
deps.state.removeSnapshot(dir, id, UNDO_SNAPSHOT);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
//#region src/doctor.ts
|
|
37
|
+
// src/doctor.ts
|
|
39
38
|
const name = "@dsh-agentic-roleplay/core/doctor";
|
|
40
39
|
const inject = [
|
|
41
40
|
"roleplayState",
|
|
@@ -163,7 +162,6 @@ function undoTool(deps) {
|
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
164
|
}
|
|
166
|
-
//#endregion
|
|
167
165
|
export { apply, doctorApproval, inject, name };
|
|
168
166
|
|
|
169
167
|
//# sourceMappingURL=doctor.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, b as mapLimit, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf } from "./library-
|
|
1
|
+
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, b as mapLimit, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf } from "./library-Dfu0dgRj.js";
|
|
2
2
|
import { join, sep } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { lstat, mkdir, readFile, readdir, realpath, rename, stat, writeFile } from "node:fs/promises";
|
|
5
|
-
|
|
5
|
+
// src/host/images/gallery.ts
|
|
6
6
|
const READ_AT_ONCE = 8;
|
|
7
7
|
const SEGMENT = /^[\p{L}\p{N}][\p{L}\p{N}\p{M}._-]{0,199}$/u;
|
|
8
8
|
const CACHE_FILE = ".index.json";
|
|
@@ -189,7 +189,6 @@ async function updateImage(sessionFolder, path, update) {
|
|
|
189
189
|
await writeImageFileMetadata(file, next);
|
|
190
190
|
return await describe(join(sessionFolder, "images"), path);
|
|
191
191
|
}
|
|
192
|
-
//#endregion
|
|
193
192
|
export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
|
|
194
193
|
|
|
195
|
-
//# sourceMappingURL=gallery-
|
|
194
|
+
//# sourceMappingURL=gallery-D1V4h8vh.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-
|
|
2
|
-
|
|
1
|
+
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-Dfu0dgRj.js";
|
|
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. */
|
|
5
5
|
function referenceDescription(request) {
|
|
@@ -139,7 +139,6 @@ async function generateTransientImage(service, request) {
|
|
|
139
139
|
await writeImage(path, image.data, metadata);
|
|
140
140
|
return path;
|
|
141
141
|
}
|
|
142
|
-
//#endregion
|
|
143
142
|
export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
|
|
144
143
|
|
|
145
|
-
//# sourceMappingURL=generator-
|
|
144
|
+
//# sourceMappingURL=generator-CLPosooC.js.map
|
package/lib/helper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as helpers } from "./child-
|
|
2
|
-
|
|
1
|
+
import { o as helpers } from "./child-lYYeOwl2.js";
|
|
2
|
+
// src/helper.ts
|
|
3
3
|
const name = "@dsh-agentic-roleplay/core/helper";
|
|
4
4
|
const inject = ["tools", "systemPrompt"];
|
|
5
5
|
/**
|
|
@@ -20,7 +20,6 @@ function apply(ctx) {
|
|
|
20
20
|
helpers.get(agent.session.id)?.setup(agent);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { apply, inject, name };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=helper.js.map
|