@dsh-agentic-roleplay/core 0.10.1 → 0.10.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/icon.svg +13 -0
- package/lib/{authoring-tools-C6Hzy8jU.js → authoring-tools-C9cmcUbD.js} +424 -31
- package/lib/authoring.js +6 -6
- package/lib/{child-C8r8AFpm.js → child-C9nPIy9j.js} +7 -3
- package/lib/client.js +2196 -728
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +1 -1
- package/lib/doctor.js +2 -2
- package/lib/helper.js +8 -1
- package/lib/{hooks-BuQ61nvQ.js → hooks-BpLN_hhT.js} +180 -153
- package/lib/images.js +1 -1
- package/lib/index.js +456 -61
- package/lib/{lorebook-author-tools-B6_Jj8oe.js → lorebook-author-tools-Cg7QQemi.js} +4 -4
- package/lib/lorebook-authoring.js +4 -4
- package/lib/orchestration.js +65 -15
- package/lib/{pack-jail-OZSgU85i.js → pack-jail-D5j5mIq6.js} +12 -8
- package/lib/{packs-B88bxt8E.js → packs-Cc05FrId.js} +2 -2
- package/lib/{presenter-agent-D-WNs626.js → presenter-agent-UKbKYXMO.js} +3 -3
- package/lib/{preset-DNuqvMan.js → preset-Be4lz6vB.js} +4 -4
- package/lib/{preset-author-tools-CDwavcTb.js → preset-author-tools-C3s0iSfv.js} +5 -5
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-9_MNxwaw.js → presets-Cl9sU3Qs.js} +52 -10
- package/lib/{reflection-BvM0w1R4.js → reflection-I9z-PvFK.js} +8 -6
- package/lib/{turn-guard-Ygdww1Wt.js → turn-guard-B9pGCeir.js} +3 -3
- package/package.json +4 -2
- package/prompts/en/checks/decide-opening.md +7 -1
- package/prompts/en/roleplay/record-keeper.md +2 -1
- package/prompts/zh/checks/decide-opening.md +7 -1
- package/prompts/zh/roleplay/record-keeper.md +2 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-CXtaZNbx.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $ as IMPORT_FOLDER, Lt as LORE_KINDS, Q as withPlayer, Rt as LORE_SCOPES, Y as cleanText, Z as partsOf, n as createPresetFromGuidance } from "./presets-
|
|
2
|
+
import { _t as writeLorebookEntry, ct as deleteLorebookEntry, ft as loadLorebook, gt as updateLorebookInfo, i as contextOf, lt as entriesOf, mt as readLorebook$1, pt as lorebookDirectory, r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools-C9cmcUbD.js";
|
|
3
|
+
import { $ as IMPORT_FOLDER, Lt as LORE_KINDS, Q as withPlayer, Rt as LORE_SCOPES, Y as cleanText, Z as partsOf, n as createPresetFromGuidance } from "./presets-Cl9sU3Qs.js";
|
|
4
4
|
import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
6
|
-
import {
|
|
6
|
+
import { nt as shippedPromptsDirectory } from "./hooks-BpLN_hhT.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
@@ -696,4 +696,4 @@ async function lorebookApproval(exec, next, state) {
|
|
|
696
696
|
}
|
|
697
697
|
export { lorebookImportMessage as a, readLorebook as c, lorebookOfChat as d, lorebookAuthorTools as i, selectEntries as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, previewLorebook as s, LOREBOOK_UPLOAD as t, lorebookChatSessionId as u };
|
|
698
698
|
|
|
699
|
-
//# sourceMappingURL=lorebook-author-tools-
|
|
699
|
+
//# sourceMappingURL=lorebook-author-tools-Cg7QQemi.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-
|
|
4
|
-
import "./hooks-
|
|
1
|
+
import { n as limitAuthoringAgents, pt as lorebookDirectory } from "./authoring-tools-C9cmcUbD.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-B9pGCeir.js";
|
|
3
|
+
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-Cg7QQemi.js";
|
|
4
|
+
import "./hooks-BpLN_hhT.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync, readdirSync } from "node:fs";
|
|
7
7
|
// src/lorebook-authoring.ts
|
package/lib/orchestration.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { c as chatSessionId, l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as whereabouts, m as referent, n as memoryReflector, p as sameWords, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-
|
|
5
|
-
import { B as modeFor, H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, Vt as INTENT_STATUSES, m as STANDING_PROMPT } from "./presets-
|
|
2
|
+
import { B as COMMANDS_KEY, H as commandsOf, P as wrongLanguage, T as RESULTS, V as commandFlagKey, c as record, dt as ClockError, f as MAX_OOC_ANSWER, ht as AUTHORING_NEEDS, l as characterRunner, mt as zoneOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, pt as describeWhen, r as externalGiven, rt as shippedText, s as createTools$1, st as ReflectionRefusedError, u as toolEnabled, v as readVerdicts, y as writeVerdicts } from "./hooks-BpLN_hhT.js";
|
|
3
|
+
import { E as tokensOf, S as currentTurn, T as estimateAnswer, a as childTrace, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
|
|
4
|
+
import { a as whereabouts, m as referent, n as memoryReflector, p as sameWords, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-I9z-PvFK.js";
|
|
5
|
+
import { B as modeFor, H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, Vt as INTENT_STATUSES, m as STANDING_PROMPT } from "./presets-Cl9sU3Qs.js";
|
|
6
6
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
7
7
|
import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-B0hConSw.js";
|
|
8
8
|
import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CH-ahlm0.js";
|
|
9
|
-
import { _ as API_PREFIX } from "./packs-
|
|
9
|
+
import { _ as API_PREFIX } from "./packs-Cc05FrId.js";
|
|
10
10
|
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CtG-bDzz.js";
|
|
11
|
-
import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-
|
|
11
|
+
import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-UKbKYXMO.js";
|
|
12
12
|
import { join } from "node:path";
|
|
13
|
+
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
|
|
13
14
|
import { existsSync } from "node:fs";
|
|
14
15
|
import { createHash } from "node:crypto";
|
|
15
16
|
import { readdir } from "node:fs/promises";
|
|
16
17
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
17
18
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
18
|
-
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
|
|
19
19
|
// src/host/tools/resource-hint.ts
|
|
20
20
|
/** The name DSH's MCP resource plugin gives the prompt paragraph it adds for every agent; a section of the same name in an agent's scope replaces it. */
|
|
21
21
|
const RESOURCE_HINT_SECTION = "mcp-resource-servers";
|
|
@@ -81,9 +81,34 @@ function canonicalTags(known, tags) {
|
|
|
81
81
|
});
|
|
82
82
|
return [...new Set(canonical)];
|
|
83
83
|
}
|
|
84
|
+
const phrase = (label) => label.normalize("NFKC").trim().toLowerCase().replace(/\s+/g, " ");
|
|
85
|
+
/** How often each relationship label is used by the story (spellings that differ only in case or spacing count together, under the most used one), most used first: the vocabulary a new label is chosen from. */
|
|
86
|
+
function labelUsage(labels) {
|
|
87
|
+
const groups = /* @__PURE__ */ new Map();
|
|
88
|
+
for (const label of labels) {
|
|
89
|
+
const key = phrase(label);
|
|
90
|
+
if (key === "") continue;
|
|
91
|
+
const spellings = groups.get(key) ?? /* @__PURE__ */ new Map();
|
|
92
|
+
spellings.set(label.trim(), (spellings.get(label.trim()) ?? 0) + 1);
|
|
93
|
+
groups.set(key, spellings);
|
|
94
|
+
}
|
|
95
|
+
const counts = [...groups.values()].map((spellings) => [[...spellings].sort((a, b) => b[1] - a[1])[0][0], [...spellings.values()].reduce((sum, n) => sum + n, 0)]);
|
|
96
|
+
return new Map(counts.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A relationship label spelled differently from one in use (case, spacing, a plural, one letter off in a long word)
|
|
100
|
+
* becomes the existing spelling, so the story keeps one word for one kind of bond. A label that matches nothing stays: a new bond is allowed.
|
|
101
|
+
*/
|
|
102
|
+
function canonicalLabel(known, label) {
|
|
103
|
+
const wanted = phrase(label);
|
|
104
|
+
if (wanted === "") return label;
|
|
105
|
+
const vocabulary = [...known.keys()];
|
|
106
|
+
return vocabulary.find((existing) => phrase(existing) === wanted) ?? vocabulary.find((existing) => stem(existing) === stem(wanted)) ?? (/^[a-z]{5,}$/.test(wanted) ? vocabulary.find((existing) => /^[a-z]{5,}$/.test(phrase(existing)) && nearby(phrase(existing), wanted)) : void 0) ?? label;
|
|
107
|
+
}
|
|
84
108
|
// src/host/orchestration/committer.ts
|
|
85
109
|
/** How many of the tags in use a brief lists. */
|
|
86
110
|
const TAGS_LISTED = 60;
|
|
111
|
+
const LABELS_LISTED = 30;
|
|
87
112
|
/** What the keeper reads back by default: the parts of the records its edits write. */
|
|
88
113
|
const VERIFY_SECTIONS = [
|
|
89
114
|
"characters",
|
|
@@ -129,6 +154,7 @@ function describePrompt(job, memory) {
|
|
|
129
154
|
const own = job.store.story.records({ rounds }).events;
|
|
130
155
|
const known = new Map(job.store.cast().map((member) => [member.key, referent(member.character)]));
|
|
131
156
|
const tags = [...tagUsage(job.store.story.events.list())].slice(0, TAGS_LISTED);
|
|
157
|
+
const labels = [...labelUsage(job.store.story.relationships.list().map((bond) => bond.label))].slice(0, LABELS_LISTED);
|
|
132
158
|
const before = records.events.filter((event) => event.turn < first.turn || event.turn === first.turn && event.round < first.round).slice(-6);
|
|
133
159
|
return [
|
|
134
160
|
memory.flaky ? "Perception in this chat: characters do not perceive perfectly. Mark a perception partial only when the character could take in just part of it (overheard, glimpsed), and mistaken only when the material shows it taking in something false; in both cases put the character's own version in content. Otherwise it is accurate and content is left out." : "Perception in this chat: every character perceives exactly what happened. Leave accuracy and content out.",
|
|
@@ -150,6 +176,9 @@ function describePrompt(job, memory) {
|
|
|
150
176
|
"## Tags already in use (choose from these; a new tag only when none fits)",
|
|
151
177
|
...tags.length === 0 ? ["- none yet"] : [tags.map(([tag, count]) => `${tag} (${count})`).join(", ")],
|
|
152
178
|
"",
|
|
179
|
+
"## Relationship labels already in use (use the same word for the same kind of bond; a new label only when none fits)",
|
|
180
|
+
...labels.length === 0 ? ["- none yet"] : [labels.map(([label, count]) => `${label} (${count})`).join(", ")],
|
|
181
|
+
"",
|
|
153
182
|
"## Goals of the characters (ids for intent_edits)",
|
|
154
183
|
...records.characters.flatMap((entry) => entry.goals.map((goal) => `- id ${goal.id}, ${entry.character}: ${goal.name} (${goal.type}, ${goal.status}${goal.deadline === null ? "" : `, deadline ${goal.deadline}`})${goal.plan.length === 0 ? "" : ` plan: ${goal.plan.join("; ")}`}`)).concat(records.characters.every((entry) => entry.goals.length === 0) ? ["- none"] : []),
|
|
155
184
|
"",
|
|
@@ -225,7 +254,7 @@ function keeperTools(job, memory, progress) {
|
|
|
225
254
|
].join(" ")
|
|
226
255
|
});
|
|
227
256
|
if (wording !== void 0) throw new InvalidEditError([wording]);
|
|
228
|
-
const result = await tool.execute(withKnownTags(args, tagUsage(job.store.story.events.list())), exec);
|
|
257
|
+
const result = await tool.execute(withKnownLabels(withKnownTags(args, tagUsage(job.store.story.events.list())), labelUsage(job.store.story.relationships.list().map((bond) => bond.label))), exec);
|
|
229
258
|
progress.edits += 1;
|
|
230
259
|
progress.unchecked = true;
|
|
231
260
|
return result;
|
|
@@ -249,6 +278,18 @@ function keeperTools(job, memory, progress) {
|
|
|
249
278
|
return tool;
|
|
250
279
|
});
|
|
251
280
|
}
|
|
281
|
+
/** The edit with the labels of its relationships brought onto the labels already in use. */
|
|
282
|
+
function withKnownLabels(args, known) {
|
|
283
|
+
const edit = args;
|
|
284
|
+
if (edit.relationships === void 0) return args;
|
|
285
|
+
return {
|
|
286
|
+
...edit,
|
|
287
|
+
relationships: edit.relationships.map((entry) => typeof entry.label === "string" ? {
|
|
288
|
+
...entry,
|
|
289
|
+
label: canonicalLabel(known, entry.label)
|
|
290
|
+
} : entry)
|
|
291
|
+
};
|
|
292
|
+
}
|
|
252
293
|
/** The edit with the tags of its new and edited events brought onto the tags already in use. */
|
|
253
294
|
function withKnownTags(args, known) {
|
|
254
295
|
const edit = args;
|
|
@@ -365,6 +406,7 @@ function suggestionWriter(deps) {
|
|
|
365
406
|
reasoningEffort: job.store.settings().reasoning.children,
|
|
366
407
|
sampling: childSampling(job.store.settings(), "suggestions", estimateAnswer(Array.from({ length: job.count }, () => 200), job.store.settings().prompts.language)),
|
|
367
408
|
...childModel(job.store.settings(), "suggestions"),
|
|
409
|
+
turn: job.turn,
|
|
368
410
|
trace: childTrace(job.store, "suggestions", "suggestions"),
|
|
369
411
|
persona: promptFor(parent, "roleplay/suggester", job.store.settings().prompts.language, { max: 200 }),
|
|
370
412
|
prompt: promptOf(job),
|
|
@@ -454,6 +496,7 @@ function triggerJudge(deps) {
|
|
|
454
496
|
const answer = await runChild({
|
|
455
497
|
parent,
|
|
456
498
|
signal,
|
|
499
|
+
turn: job.turn,
|
|
457
500
|
reasoningEffort: settings.reasoning.children,
|
|
458
501
|
sampling: childSampling(settings, "records", estimateAnswer(subset.flatMap(() => [
|
|
459
502
|
REASON_CHARS$1,
|
|
@@ -898,6 +941,7 @@ function factionStrategist(deps) {
|
|
|
898
941
|
const strategy = await runChild({
|
|
899
942
|
parent,
|
|
900
943
|
signal,
|
|
944
|
+
turn: job.turn,
|
|
901
945
|
reasoningEffort: store.settings().reasoning.children,
|
|
902
946
|
sampling: childSampling(store.settings(), "authoring", estimateAnswer(DECISION_LIMITS, store.settings().prompts.language)),
|
|
903
947
|
...childModel(store.settings(), "authoring"),
|
|
@@ -1215,6 +1259,7 @@ function worldAuthor(deps) {
|
|
|
1215
1259
|
reasoningEffort: job.store.settings().reasoning.children,
|
|
1216
1260
|
sampling: childSampling(job.store.settings(), "authoring", editEstimate(authoring.perTurn, THING_TEXTS, THING_TEXT_CHARS, job.store.settings().prompts.language)),
|
|
1217
1261
|
...childModel(job.store.settings(), "authoring"),
|
|
1262
|
+
turn: job.turn,
|
|
1218
1263
|
trace: childTrace(job.store, "authoring", "world author"),
|
|
1219
1264
|
parent,
|
|
1220
1265
|
signal,
|
|
@@ -1265,6 +1310,7 @@ function worldAuthor(deps) {
|
|
|
1265
1310
|
reasoningEffort: job.store.settings().reasoning.children,
|
|
1266
1311
|
sampling: childSampling(job.store.settings(), "authoring", editEstimate(pending.length, FIT_TEXTS, FIT_TEXT_CHARS, job.store.settings().prompts.language)),
|
|
1267
1312
|
...childModel(job.store.settings(), "authoring"),
|
|
1313
|
+
turn: job.turn,
|
|
1268
1314
|
trace: childTrace(job.store, "authoring", "world consolidation"),
|
|
1269
1315
|
parent,
|
|
1270
1316
|
signal,
|
|
@@ -1724,7 +1770,7 @@ var AfterTurnJobs = class {
|
|
|
1724
1770
|
this.deps.problem(`what the characters believe was not sorted: ${messageOf(error)}`);
|
|
1725
1771
|
}).finally(() => {
|
|
1726
1772
|
this.reflecting.delete(owner.chat);
|
|
1727
|
-
}));
|
|
1773
|
+
}), true);
|
|
1728
1774
|
}
|
|
1729
1775
|
/** Fit what was made up into the rest of the world, when enough of it is waiting or some has waited long. */
|
|
1730
1776
|
consolidate(owner, cancel) {
|
|
@@ -2630,6 +2676,7 @@ var TurnEngine = class {
|
|
|
2630
2676
|
objections = /* @__PURE__ */ new Map();
|
|
2631
2677
|
/** What runs in the background of each chat and writes to its story, other than the records: fitting in what was made up, and the characters away. */
|
|
2632
2678
|
working = /* @__PURE__ */ new Map();
|
|
2679
|
+
optionalJobs = /* @__PURE__ */ new WeakSet();
|
|
2633
2680
|
afterTurn;
|
|
2634
2681
|
/** What a reflection the player asked for is cancelled with, as `stop` does for the turn. */
|
|
2635
2682
|
reflectionCancels = /* @__PURE__ */ new Map();
|
|
@@ -2643,8 +2690,8 @@ var TurnEngine = class {
|
|
|
2643
2690
|
this.afterTurn = new AfterTurnJobs({
|
|
2644
2691
|
boundaries: () => this.boundaries(),
|
|
2645
2692
|
stores: (chat) => this.stores(chat),
|
|
2646
|
-
track: (chat, job) => {
|
|
2647
|
-
this.track(chat, job);
|
|
2693
|
+
track: (chat, job, optional) => {
|
|
2694
|
+
this.track(chat, job, optional);
|
|
2648
2695
|
},
|
|
2649
2696
|
problem: (message) => {
|
|
2650
2697
|
this.problem(message);
|
|
@@ -3238,10 +3285,12 @@ var TurnEngine = class {
|
|
|
3238
3285
|
});
|
|
3239
3286
|
return count <= MAX_OBJECTIONS;
|
|
3240
3287
|
}
|
|
3241
|
-
|
|
3288
|
+
/** `optional` work (reflection) is waited for by anything that moves or ends the story, but not by the next turn: it only adds beliefs, and a pass can take minutes. */
|
|
3289
|
+
track(chat, job, optional = false) {
|
|
3242
3290
|
const set = this.working.get(chat) ?? /* @__PURE__ */ new Set();
|
|
3243
3291
|
this.working.set(chat, set);
|
|
3244
3292
|
set.add(job);
|
|
3293
|
+
if (optional) this.optionalJobs.add(job);
|
|
3245
3294
|
job.finally(() => {
|
|
3246
3295
|
set.delete(job);
|
|
3247
3296
|
});
|
|
@@ -3252,10 +3301,11 @@ var TurnEngine = class {
|
|
|
3252
3301
|
this.reflectionCancels.get(chat)?.abort();
|
|
3253
3302
|
}
|
|
3254
3303
|
/** Resolves when nothing of the chat writes to its story any more: the records, what was made up being fitted in, the characters away, the suggestions. */
|
|
3255
|
-
async quiesce(chat) {
|
|
3304
|
+
async quiesce(chat, options = {}) {
|
|
3256
3305
|
for (;;) {
|
|
3257
|
-
const
|
|
3258
|
-
|
|
3306
|
+
const working = [...this.working.get(chat) ?? []].filter((job) => options.skipOptional !== true || !this.optionalJobs.has(job));
|
|
3307
|
+
const jobs = [...working, ...this.chains.has(chat) ? [this.chains.get(chat)] : []];
|
|
3308
|
+
if (jobs.length === 0 || (this.runs.get(chat) ?? 0) === 0 && working.length === 0) return;
|
|
3259
3309
|
await Promise.allSettled(jobs);
|
|
3260
3310
|
}
|
|
3261
3311
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { c as chatSessionId, n as atomicWrite, r as atomicWriteJson } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { A as editsSince, B as addressesToFetch, Bt as
|
|
3
|
-
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-
|
|
2
|
+
import { $t as subfolders, A as editsSince, B as addressesToFetch, Bt as loadLocations, C as worldFieldChanges, E as loadWorldParts, Ft as TRIGGERS_FILE_NAME, H as fetchPictures, Ht as loadItems, It as loadTriggers, J as UPDATE_FOLDER, K as cardCharacter, Lt as LORE_DIR, Qt as loadCharacters, Rt as loadLore, Ut as FACTIONS_DIR, V as candidateUrls, Vt as ITEMS_DIR, W as mergeReports, Wt as loadFactions, X as cardPieces, Y as baseId, Yt as loadCalendar, Zt as CHARACTERS_DIR, bt as withScratchStory, c as importPhase, i as contextOf, j as writeSnapshot, k as recordProvenance, ln as authoredWorldOf, q as writePortrait, s as worldOf, un as authoringChatSessionId, w as editWorldInfo, x as matchPieces, xt as knowsCharacter, yt as loadValidatedWorld, z as addressKey, zt as LOCATIONS_DIR } from "./authoring-tools-C9cmcUbD.js";
|
|
3
|
+
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-Cl9sU3Qs.js";
|
|
4
4
|
import { n as encodeOutput } from "./narration-B0hConSw.js";
|
|
5
|
-
import {
|
|
5
|
+
import { A as LANGUAGE_NAMES, G as formatIssue, I as PLOTS_FILE_NAME, J as PROMPTS_FOLDER, L as loadPlots, M as isStoryLanguage, N as textLanguage, R as parsePlotsFile, W as Reader, it as AgentUnavailableError, j as STORY_LANGUAGES, ot as InvalidWorldError, tt as shippedLanguages, ut as WorldNotFoundError, z as plotReferenceProblems } from "./hooks-BpLN_hhT.js";
|
|
6
6
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
7
7
|
import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
8
|
-
import { n as readPreset } from "./preset-
|
|
9
|
-
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-
|
|
8
|
+
import { n as readPreset } from "./preset-Be4lz6vB.js";
|
|
9
|
+
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-Cc05FrId.js";
|
|
10
10
|
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
|
|
11
11
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
12
|
+
import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
|
|
12
13
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
13
14
|
import { randomUUID } from "node:crypto";
|
|
14
15
|
import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -16,7 +17,6 @@ import { Session, SessionId } from "@deepseek-ai/dsh-session";
|
|
|
16
17
|
import { ToolCallId, createMessage, createSystemMessage, createToolResultMessage } from "@deepseek-ai/dsh-llm";
|
|
17
18
|
import { setApprovalPolicy } from "@deepseek-ai/dsh-user-approval";
|
|
18
19
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
19
|
-
import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
|
|
20
20
|
// src/host/agent/opening.ts
|
|
21
21
|
/** What the opening is reported to come from, where a chat shows the source of a message. */
|
|
22
22
|
const OPENING_SOURCE = {
|
|
@@ -836,7 +836,11 @@ const FIELDS$1 = {
|
|
|
836
836
|
"opening_message",
|
|
837
837
|
"opening_message[].text",
|
|
838
838
|
"alternate_openings[].title",
|
|
839
|
-
"alternate_openings[].text"
|
|
839
|
+
"alternate_openings[].text",
|
|
840
|
+
"start_questions[].text",
|
|
841
|
+
"start_questions[].options[].label",
|
|
842
|
+
"start_questions[].options[].description",
|
|
843
|
+
"start_questions[].options[].effect.rules[]"
|
|
840
844
|
]
|
|
841
845
|
},
|
|
842
846
|
calendar: {
|
|
@@ -2649,4 +2653,4 @@ function registerPackJail(ctx, deps) {
|
|
|
2649
2653
|
}
|
|
2650
2654
|
export { DOCTOR_OPENING_SOURCE as $, worldEntityImageFile as A, languageOfDocuments as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, PRESET_FILE as F, revertUpdate as G, findTargets as H, presetMessage as I, AuthoringSessions as J, startUpdate as K, presetTools as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, agentServicesOf as Q, translateMessage as R, generateWorldEntityImage as S, removeWorldTrigger as T, finishUpdate as U, readWorldDocuments as V, pendingUpdate as W, ensureAuthoringChat as X, authoringTitle as Y, AgentSessions as Z, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, appendEmptyTurn as et, 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, updateStatus as q, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, appendNarratedTurn as tt, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, translateTools as z };
|
|
2651
2655
|
|
|
2652
|
-
//# sourceMappingURL=pack-jail-
|
|
2656
|
+
//# sourceMappingURL=pack-jail-D5j5mIq6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as Reader } from "./hooks-BpLN_hhT.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";
|
|
@@ -836,4 +836,4 @@ function anyTab(bases) {
|
|
|
836
836
|
}
|
|
837
837
|
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 };
|
|
838
838
|
|
|
839
|
-
//# sourceMappingURL=packs-
|
|
839
|
+
//# sourceMappingURL=packs-Cc05FrId.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { n as atomicWrite, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as runChild } from "./child-C9nPIy9j.js";
|
|
3
3
|
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
|
|
4
4
|
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-CtG-bDzz.js";
|
|
5
5
|
import { c as nextSceneSerial, u as referenceImagePath } from "./library-CH-ahlm0.js";
|
|
6
6
|
import { join, relative } from "node:path";
|
|
7
|
+
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
7
8
|
import { existsSync } from "node:fs";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
10
|
import { readFile } from "node:fs/promises";
|
|
10
11
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
11
|
-
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
12
12
|
// src/host/images/presented.ts
|
|
13
13
|
const PRESENTED_FOLDER = "presented";
|
|
14
14
|
const fileOf = (folder, node) => join(folder, "images", PRESENTED_FOLDER, `${node}.json`);
|
|
@@ -841,4 +841,4 @@ async function runImagePresenter(job) {
|
|
|
841
841
|
}
|
|
842
842
|
export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
|
|
843
843
|
|
|
844
|
-
//# sourceMappingURL=presenter-agent-
|
|
844
|
+
//# sourceMappingURL=presenter-agent-UKbKYXMO.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Y as cleanText } from "./presets-
|
|
1
|
+
import { r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools-C9cmcUbD.js";
|
|
2
|
+
import { u as SAMPLING_RANGES } from "./child-C9nPIy9j.js";
|
|
3
|
+
import { Y as cleanText } from "./presets-Cl9sU3Qs.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-Be4lz6vB.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-CXtaZNbx.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-
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import { i as contextOf } from "./authoring-tools-
|
|
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-Cl9sU3Qs.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-Be4lz6vB.js";
|
|
4
|
+
import { i as contextOf } from "./authoring-tools-C9cmcUbD.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Q as languageOf$1, nt as shippedPromptsDirectory, tt as shippedLanguages } from "./hooks-BpLN_hhT.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-C3s0iSfv.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-C9cmcUbD.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-B9pGCeir.js";
|
|
3
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-C3s0iSfv.js";
|
|
4
|
+
import "./hooks-BpLN_hhT.js";
|
|
5
|
+
import { c as presetDirectory } from "./presets-Cl9sU3Qs.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
// src/preset-authoring.ts
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-CXtaZNbx.js";
|
|
2
2
|
import "./narration-B0hConSw.js";
|
|
3
|
-
import {
|
|
3
|
+
import { $ as listFiles, G as formatIssue, J as PROMPTS_FOLDER, K as errorMessage, Q as languageOf, U as readDocument, W as Reader, et as promptProblem, nt as shippedPromptsDirectory, q as LANGUAGE_FOLDER, tt as shippedLanguages } from "./hooks-BpLN_hhT.js";
|
|
4
4
|
import { i as translator, r as languageOf$1 } from "./text-CzqhC8sT.js";
|
|
5
|
-
import {
|
|
5
|
+
import { d as parseSampling } from "./child-C9nPIy9j.js";
|
|
6
6
|
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
|
+
import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, valueIssue } from "@dsh-agentic-roleplay/state";
|
|
8
9
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
9
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
11
|
import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
11
|
-
import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, valueIssue } from "@dsh-agentic-roleplay/state";
|
|
12
12
|
// ../dsh-roleplay-model/src/character.ts
|
|
13
13
|
const CHARACTER_ROLES = ["playable", "npc"];
|
|
14
14
|
const CHARACTER_TIERS = [
|
|
@@ -2577,8 +2577,19 @@ const emptyExtracted = () => ({
|
|
|
2577
2577
|
casting: [],
|
|
2578
2578
|
commands: [],
|
|
2579
2579
|
triggers: [],
|
|
2580
|
-
notes: []
|
|
2580
|
+
notes: [],
|
|
2581
|
+
derived: []
|
|
2581
2582
|
});
|
|
2583
|
+
const baseOf = (id) => id.replace(/#\d+$/, "");
|
|
2584
|
+
/** The ids of the card pieces whose text is among these texts (one of them may have been cut short to fit a request). */
|
|
2585
|
+
function piecesOfTexts(card, items, texts) {
|
|
2586
|
+
const known = [
|
|
2587
|
+
...items.map((item) => [item.text, baseOf(item.id)]),
|
|
2588
|
+
[cleanText(card.systemPrompt, card.name), "field:system-prompt"],
|
|
2589
|
+
[cleanText(card.postHistoryInstructions, card.name), "field:post-history"]
|
|
2590
|
+
];
|
|
2591
|
+
return [...new Set(known.filter(([body]) => body !== "" && texts.some((text) => text !== "" && (body.startsWith(text) || text.startsWith(body)))).map(([, id]) => id))];
|
|
2592
|
+
}
|
|
2582
2593
|
const SOURCE_BUDGET_CHARS = 14e3;
|
|
2583
2594
|
const MAX_TAGGED = 8;
|
|
2584
2595
|
const MAX_MENTIONS = 6;
|
|
@@ -3504,6 +3515,16 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
3504
3515
|
if (failure !== void 0) result.notes.push(failure);
|
|
3505
3516
|
const name = item.title === "" ? item.label : item.title;
|
|
3506
3517
|
result.casting.push(...casting);
|
|
3518
|
+
if (casting.length > 0) result.derived.push({
|
|
3519
|
+
kind: "command",
|
|
3520
|
+
name: "",
|
|
3521
|
+
pieces: [baseOf(item.id)]
|
|
3522
|
+
});
|
|
3523
|
+
if (rules.length > 0) result.derived.push({
|
|
3524
|
+
kind: "rules",
|
|
3525
|
+
name,
|
|
3526
|
+
pieces: [baseOf(item.id)]
|
|
3527
|
+
});
|
|
3507
3528
|
if (casting.length > 0) addLore(result.lore, {
|
|
3508
3529
|
id: uniqueKey(slug(item.label, "guidance"), taken),
|
|
3509
3530
|
...guidanceEntry(casting, tr("{label}: how people are made up", { label: name }))
|
|
@@ -3572,7 +3593,17 @@ function styleProblem(id, value, personas = []) {
|
|
|
3572
3593
|
}
|
|
3573
3594
|
/** Turns the instructions of a card into the prose prompts of the world. Only prose and behaviour are kept: the rules of the game stay the program's. */
|
|
3574
3595
|
async function extractStyle(ctx, card, items, classified) {
|
|
3575
|
-
|
|
3596
|
+
const texts = instructionPieces(card, items, classified);
|
|
3597
|
+
const made = await extractStyleFrom(ctx, card.name, texts);
|
|
3598
|
+
const pieces = piecesOfTexts(card, items, texts);
|
|
3599
|
+
return {
|
|
3600
|
+
...made,
|
|
3601
|
+
derived: made.prompts.map((prompt) => ({
|
|
3602
|
+
kind: "prompt",
|
|
3603
|
+
name: prompt.id,
|
|
3604
|
+
pieces
|
|
3605
|
+
}))
|
|
3606
|
+
};
|
|
3576
3607
|
}
|
|
3577
3608
|
/** The prose prompts that instruction texts become, and what was left out of them. */
|
|
3578
3609
|
async function extractStyleFrom(ctx, name, pieces) {
|
|
@@ -3799,7 +3830,8 @@ async function extractVariables(ctx, card, items, classified, roster) {
|
|
|
3799
3830
|
const groups = trackingGroups(trackingPieces(card, items, classified));
|
|
3800
3831
|
if (groups.length === 0) return {
|
|
3801
3832
|
variables: [],
|
|
3802
|
-
notes: []
|
|
3833
|
+
notes: [],
|
|
3834
|
+
derived: []
|
|
3803
3835
|
};
|
|
3804
3836
|
const perRequest = ctx.variablesPerRequest ?? DEFAULT_VARIABLES_PER_REQUEST;
|
|
3805
3837
|
const names = (kind) => roster.filter((entity) => entity.kind === kind).map((entity) => entity.name).join(", ");
|
|
@@ -3838,14 +3870,24 @@ async function extractVariables(ctx, card, items, classified, roster) {
|
|
|
3838
3870
|
}
|
|
3839
3871
|
return {
|
|
3840
3872
|
documents,
|
|
3841
|
-
notes
|
|
3873
|
+
notes,
|
|
3874
|
+
pieces: piecesOfTexts(card, items, pieces)
|
|
3842
3875
|
};
|
|
3843
3876
|
});
|
|
3844
3877
|
const variables = [];
|
|
3845
|
-
|
|
3878
|
+
const derived = [];
|
|
3879
|
+
for (const entry of found) for (const document of entry.documents) if (!variables.some((kept) => kept["key"] === document["key"])) {
|
|
3880
|
+
variables.push(document);
|
|
3881
|
+
derived.push({
|
|
3882
|
+
kind: "variable",
|
|
3883
|
+
name: text(document["name"]) || text(document["key"]),
|
|
3884
|
+
pieces: entry.pieces
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3846
3887
|
return {
|
|
3847
3888
|
variables,
|
|
3848
|
-
notes: found.flatMap((entry) => entry.notes)
|
|
3889
|
+
notes: found.flatMap((entry) => entry.notes),
|
|
3890
|
+
derived
|
|
3849
3891
|
};
|
|
3850
3892
|
}
|
|
3851
3893
|
// src/host/presets/presets.ts
|
|
@@ -4105,4 +4147,4 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
|
|
|
4105
4147
|
}
|
|
4106
4148
|
export { IMPORT_FOLDER as $, sourcesFor as A, InvalidEditProblems as At, modeFor as B, DEFAULT_SLOTS 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, isLeftOut as I, parseThingEdit as It, writeWorldPrompt as J, listWorldPrompts as K, announceProblem as L, LORE_KINDS 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_SCOPES as Rt, extractVariables as S, parseItemFile as St, pruneKnowledge as T, parseFactionFile as Tt, yesAt as U, noAt as V, INTENT_STATUSES 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, WEEKDAY_NAMES as zt };
|
|
4107
4149
|
|
|
4108
|
-
//# sourceMappingURL=presets-
|
|
4150
|
+
//# sourceMappingURL=presets-Cl9sU3Qs.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, f as sha, o as listPresets, s as loadPreset, z as mergeReports } from "./presets-
|
|
3
|
-
import {
|
|
2
|
+
import { H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, f as sha, o as listPresets, s as loadPreset, z as mergeReports } from "./presets-Cl9sU3Qs.js";
|
|
3
|
+
import { E as answerLimits, J as PROMPTS_FOLDER, P as wrongLanguage, Z as inheritPrompts, ft as describeTime, pt as describeWhen } from "./hooks-BpLN_hhT.js";
|
|
4
4
|
import { i as translator, r as languageOf, t as trimCharacters } from "./text-CzqhC8sT.js";
|
|
5
|
-
import {
|
|
5
|
+
import { T as estimateAnswer, a as childTrace, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
|
|
6
6
|
import { s as inheritImages } from "./library-CH-ahlm0.js";
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
7
|
+
import { i as inheritPacks } from "./packs-Cc05FrId.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
|
+
import { MINUTE, characterKey, describeDuration, locationKey, mentioned, overlap, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
9
10
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
10
11
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
11
|
-
import { MINUTE, characterKey, describeDuration, locationKey, mentioned, overlap, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
12
12
|
// ../dsh-roleplay-model/src/memory.ts
|
|
13
13
|
const MEMORY_KINDS = [
|
|
14
14
|
"belief",
|
|
@@ -1968,6 +1968,7 @@ function memoryReflector(deps) {
|
|
|
1968
1968
|
verdict = await runChild({
|
|
1969
1969
|
parent,
|
|
1970
1970
|
signal,
|
|
1971
|
+
turn: job.turn,
|
|
1971
1972
|
reasoningEffort: settings.reasoning.children,
|
|
1972
1973
|
sampling: childSampling(settings, "records", estimateAnswer([MAX_TEXT * 2, 100], settings.prompts.language)),
|
|
1973
1974
|
...childModel(settings, "records"),
|
|
@@ -2027,6 +2028,7 @@ function memoryReflector(deps) {
|
|
|
2027
2028
|
const proposal = withDoubts(settleProposal(await runChild({
|
|
2028
2029
|
parent,
|
|
2029
2030
|
signal,
|
|
2031
|
+
turn: job.turn,
|
|
2030
2032
|
reasoningEffort: settings.reasoning.children,
|
|
2031
2033
|
sampling: childSampling(settings, "records", estimateAnswer(Array.from({ length: 14 }, () => MAX_TEXT), settings.prompts.language)),
|
|
2032
2034
|
...childModel(settings, "records"),
|
|
@@ -2095,4 +2097,4 @@ function memoryReflector(deps) {
|
|
|
2095
2097
|
}
|
|
2096
2098
|
export { START_SNAPSHOT as _, whereabouts as a, snapshotOf as b, copyPreset as c, switchPreset as d, defaultBoundaries as f, writeTimeline as g, readTimeline as h, reflectionStatus as i, presetStatus as l, referent as m, memoryReflector as n, TimelineError as o, sameWords as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u, childrenOf as v, pathTo as y };
|
|
2097
2099
|
|
|
2098
|
-
//# sourceMappingURL=reflection-
|
|
2100
|
+
//# sourceMappingURL=reflection-I9z-PvFK.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as guardRepeatedCalls } from "./hooks-
|
|
1
|
+
import { C as cutOff, w as finishOf } from "./child-C9nPIy9j.js";
|
|
2
|
+
import { d as guardRepeatedCalls } from "./hooks-BpLN_hhT.js";
|
|
3
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
// src/host/authoring/turn-guard.ts
|
|
5
5
|
/**
|
|
@@ -49,4 +49,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
49
49
|
}
|
|
50
50
|
export { guardAuthoringTurns as t };
|
|
51
51
|
|
|
52
|
-
//# sourceMappingURL=turn-guard-
|
|
52
|
+
//# sourceMappingURL=turn-guard-B9pGCeir.js.map
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Core plugin of the agentic roleplay bundle for DeepSeek Harness: roleplay UI, orchestration and storage.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Firefox2100",
|
|
7
7
|
"url": "https://github.com/Firefox2100"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"icon": "./icon.svg",
|
|
10
11
|
"main": "lib/index.js",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": "./lib/index.js",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"registry": "https://registry.npmjs.org/"
|
|
61
62
|
},
|
|
62
63
|
"files": [
|
|
64
|
+
"icon.svg",
|
|
63
65
|
"lib/*.js",
|
|
64
66
|
"packs",
|
|
65
67
|
"prompts",
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
77
79
|
},
|
|
78
80
|
"dependencies": {
|
|
79
|
-
"@dsh-agentic-roleplay/state": "0.10.
|
|
81
|
+
"@dsh-agentic-roleplay/state": "0.10.2",
|
|
80
82
|
"@dsh-ai-providers/core": "^0.5.0"
|
|
81
83
|
},
|
|
82
84
|
"devDependencies": {
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
A person is about to start a story as the character described below. Read the opening and the first scene: where the character is, who and what is there, what the character is doing or wants. Is it enough for the person to know where they are and to have something to do, a person to talk to, a problem to face or a want to follow, for the first move?
|
|
1
|
+
A person is about to start a story as the character described below. Read the opening and the first scene: where the character is, who and what is there, what the character is doing or wants. Is it enough for the person to know where they are and to have something to do, a person to talk to, a problem to face or a want to follow, for the first move?
|
|
2
|
+
|
|
3
|
+
It is not enough when the opening is missing, a single word, or only sets a mood; when the character has no want and is doing nothing; when nobody is in the place and nothing in it invites a look or a use; or when it is unclear who the player is. A way out is not something to do: being able to go elsewhere is only a road, not a reason to act, so do not answer yes because exits are listed. If nothing but the exits gives the person something to do, answer no.
|
|
4
|
+
|
|
5
|
+
It is enough when there is at least a person to talk to, a problem to face or something the character clearly wants, and the person knows where they are.
|
|
6
|
+
|
|
7
|
+
Answer yes when it is enough and no when it is not, and give the reason in a sentence.
|
|
@@ -24,4 +24,5 @@ What to write:
|
|
|
24
24
|
- beliefs: only when a character clearly learns, suspects or concludes something beyond the single event; written from that character's point of view; kind is belief, relationship or knowledge.
|
|
25
25
|
- entity knowledge: the graph is closed-world. A relationship profile means its from-character knows the to-character. For a place, item or directed exit newly learned by being told, reading, or inference, add knowledge (character, kind; subject for a place/item, from+to for an exit). Ordinary sight and movement are recorded automatically. Knowledge means only that the entity exists, never where it is now or its current state. Do not retract it merely because information became stale.
|
|
26
26
|
- factions: faction_states changes an organisation's durable public or private institutional condition; faction_memberships records joining, leaving, role, rank, visibility and commitment; faction_relationships records a character's or faction's directional view of a faction or character and is also the awareness edge. Apply the same concrete-cause and directional rules as character relationships: a member's act does not automatically change the faction's view, nor the reverse. faction_intents_added records a durable strategic goal adopted by an organisation. A faction goal pressures members but never means every member knows it or must act on it.
|
|
27
|
-
- threads_opened: only a promise, mystery or goal that the rounds clearly leave unsettled and that is not already open. threads_resolved: ids of open threads that the rounds settle.
|
|
27
|
+
- threads_opened: only a promise, mystery or goal that the rounds clearly leave unsettled and that is not already open; a thread that only restates an open one is refused, and one that looks similar but is a separate matter goes in threads_distinct. threads_resolved: ids of open threads that the rounds settle.
|
|
28
|
+
- thread knowledge: a thread is the story's own note and stays secret until the player's character has been told of it, has seen it, or has taken it on. A thread the player's character already knows of when you open it goes in threads_opened_known instead of threads_opened; the ids of open threads the character has just learned of go in threads_known (read_records shows player_knows for each). Never mark a thread because the story only hints at it, because other characters know it, or because the narration implies it: a secret stays in threads_opened and unmarked.
|