@dsh-agentic-roleplay/core 0.4.0 → 0.4.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/{authoring-tools-C_8ClUkP.js → authoring-tools-C2BHkEFP.js} +4 -4
- package/lib/authoring.js +5 -5
- package/lib/client.js +340 -308
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -2
- package/lib/doctor.js +2 -2
- package/lib/{hooks-B2EhBS_-.js → hooks-CHmUksFS.js} +85 -6
- package/lib/index.js +11 -10
- package/lib/{lorebook-author-tools-C-o0t4dL.js → lorebook-author-tools-CaT74Q7v.js} +5 -5
- package/lib/lorebook-authoring.js +3 -3
- package/lib/{narration-BT9uvQry.js → narration-DstnwrvX.js} +4 -1
- package/lib/orchestration.js +315 -21
- package/lib/{pack-jail-soI-In96.js → pack-jail-CEDDI4Xw.js} +7 -7
- package/lib/{packs-CJPSe5LI.js → packs-DB_9xiCp.js} +2 -2
- package/lib/{preset-3zn8xme7.js → preset-BL1d40oG.js} +2 -2
- package/lib/{preset-author-tools-C-X8G40s.js → preset-author-tools-B2wZXKZo.js} +5 -5
- package/lib/preset-authoring.js +4 -4
- package/lib/{presets-C3mhqqfz.js → presets-Dc15L6OU.js} +2 -2
- package/lib/{reflection-Btsj0ZLh.js → reflection-BWMVdHhR.js} +5 -5
- package/package.json +2 -2
- package/prompts/en/roleplay/record-keeper.md +3 -3
- package/prompts/zh/roleplay/record-keeper.md +3 -3
package/lib/orchestration.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { n as chatSessionId, r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
|
|
2
|
-
import { b as INTENT_STATUSES } from "./presets-
|
|
3
|
-
import { a as whereabouts, g as referent, h as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-
|
|
4
|
-
import { a as liveSettings } from "./narration-
|
|
5
|
-
import { E as
|
|
2
|
+
import { b as INTENT_STATUSES } from "./presets-Dc15L6OU.js";
|
|
3
|
+
import { a as whereabouts, g as referent, h as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-BWMVdHhR.js";
|
|
4
|
+
import { a as liveSettings, n as encodeOutput } from "./narration-DstnwrvX.js";
|
|
5
|
+
import { D as zoneOf, E as describeWhen, L as wrongLanguage, O as RESULTS, _ as readVerdicts, at as ReflectionRefusedError, c as record, d as toolEnabled, f as MAX_OOC_ANSWER, l as AUTHORING_NEEDS, lt as languageOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, r as externalGiven, s as createTools$1, u as characterRunner, ut as translator, v as writeVerdicts, w as ClockError } from "./hooks-CHmUksFS.js";
|
|
6
6
|
import { a as runChild, f as currentTurn, i as childTrace, m as tokensOf, n as childSampling, p as estimateAnswer, t as childModel } from "./child-DsixtqTw.js";
|
|
7
7
|
import { b as slug, t as addToLibrary, x as uniqueKey } from "./library-COIktKBa.js";
|
|
8
|
-
import { _ as API_PREFIX } from "./packs-
|
|
8
|
+
import { _ as API_PREFIX } from "./packs-DB_9xiCp.js";
|
|
9
9
|
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CDYKJf_O.js";
|
|
10
10
|
import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-Gu34bZwd.js";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
13
13
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
14
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
14
15
|
import { readdir } from "node:fs/promises";
|
|
15
|
-
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
16
|
+
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
16
17
|
//#region src/host/tools/resource-hint.ts
|
|
17
18
|
/** 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. */
|
|
18
19
|
const RESOURCE_HINT_SECTION = "mcp-resource-servers";
|
|
@@ -41,7 +42,48 @@ function resourceHint(visible, registered, tr) {
|
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
//#endregion
|
|
45
|
+
//#region src/host/memory/tags.ts
|
|
46
|
+
const MIN_FUZZY_LENGTH = 5;
|
|
47
|
+
const plain = (tag) => tag.normalize("NFKC").trim().toLowerCase().replace(/[\s_]+/g, "-");
|
|
48
|
+
/** What two spellings of one word share: separators and a plural ending do not make a different tag. */
|
|
49
|
+
const stem = (tag) => {
|
|
50
|
+
const joined = plain(tag).replace(/-/g, "");
|
|
51
|
+
return /^[a-z]{4,}s$/.test(joined) && !joined.endsWith("ss") ? joined.slice(0, -1) : joined;
|
|
52
|
+
};
|
|
53
|
+
/** Whether two words differ by one letter (a substitution, an insertion or a deletion). */
|
|
54
|
+
function nearby(a, b) {
|
|
55
|
+
if (Math.abs(a.length - b.length) > 1 || a === b) return a === b;
|
|
56
|
+
const [short, long] = a.length <= b.length ? [a, b] : [b, a];
|
|
57
|
+
let index = 0;
|
|
58
|
+
while (index < short.length && short[index] === long[index]) index += 1;
|
|
59
|
+
return short.length === long.length ? short.slice(index + 1) === long.slice(index + 1) : short.slice(index) === long.slice(index + 1);
|
|
60
|
+
}
|
|
61
|
+
/** How often each tag is used by the story's events, most used first: the vocabulary a new tag is chosen from. */
|
|
62
|
+
function tagUsage(events) {
|
|
63
|
+
const counts = /* @__PURE__ */ new Map();
|
|
64
|
+
for (const event of events) for (const tag of new Set(event.tags.map(plain))) if (tag !== "") counts.set(tag, (counts.get(tag) ?? 0) + 1);
|
|
65
|
+
return new Map([...counts].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Brings new tags onto the tags already in use: the same word spelled differently (case,
|
|
69
|
+
* separators, a plural, one letter off in a long word) becomes the existing tag, so recall, which
|
|
70
|
+
* matches tags exactly, finds both. A tag that matches nothing stays: "none fits" is allowed.
|
|
71
|
+
*/
|
|
72
|
+
function canonicalTags(known, tags) {
|
|
73
|
+
const vocabulary = [...known.keys()];
|
|
74
|
+
const canonical = tags.map(plain).filter((tag) => tag !== "").map((tag) => {
|
|
75
|
+
if (known.has(tag)) return tag;
|
|
76
|
+
const same = vocabulary.find((existing) => stem(existing) === stem(tag));
|
|
77
|
+
if (same !== void 0) return same;
|
|
78
|
+
if (!/^[a-z]+$/.test(tag) || tag.length < MIN_FUZZY_LENGTH) return tag;
|
|
79
|
+
return vocabulary.find((existing) => /^[a-z]+$/.test(existing) && existing.length >= MIN_FUZZY_LENGTH && nearby(existing, tag)) ?? tag;
|
|
80
|
+
});
|
|
81
|
+
return [...new Set(canonical)];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
44
84
|
//#region src/host/orchestration/committer.ts
|
|
85
|
+
/** How many of the tags in use a brief lists. */
|
|
86
|
+
const TAGS_LISTED = 60;
|
|
45
87
|
/** What the keeper reads back by default: the parts of the records its edits write. */
|
|
46
88
|
const VERIFY_SECTIONS = [
|
|
47
89
|
"characters",
|
|
@@ -86,6 +128,7 @@ function describePrompt(job, memory) {
|
|
|
86
128
|
const records = job.store.story.records({ timeZone: zoneOf(job.store.settings().clock) });
|
|
87
129
|
const own = job.store.story.records({ rounds }).events;
|
|
88
130
|
const known = new Map(job.store.cast().map((member) => [member.key, referent(member.character)]));
|
|
131
|
+
const tags = [...tagUsage(job.store.story.events.list())].slice(0, TAGS_LISTED);
|
|
89
132
|
const before = records.events.filter((event) => event.turn < first.turn || event.turn === first.turn && event.round < first.round).slice(-6);
|
|
90
133
|
return [
|
|
91
134
|
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.",
|
|
@@ -101,9 +144,12 @@ function describePrompt(job, memory) {
|
|
|
101
144
|
"## Recorded before these rounds (do not repeat)",
|
|
102
145
|
...before.length === 0 ? ["- nothing"] : before.map((event) => `- [turn ${event.turn}] ${event.text}`),
|
|
103
146
|
"",
|
|
104
|
-
"## Already recorded for these rounds (an earlier attempt
|
|
147
|
+
"## Already recorded for these rounds (the actions and words of the round, written when it was decided, and anything an earlier attempt added: improve them with event_edits, do not repeat them)",
|
|
105
148
|
...own.length === 0 ? ["- nothing"] : own.map((event) => `- id ${event.id}, ${label(event)}: ${event.text}`),
|
|
106
149
|
"",
|
|
150
|
+
"## Tags already in use (choose from these; a new tag only when none fits)",
|
|
151
|
+
...tags.length === 0 ? ["- none yet"] : [tags.map(([tag, count]) => `${tag} (${count})`).join(", ")],
|
|
152
|
+
"",
|
|
107
153
|
"## Goals of the characters (ids for intent_edits)",
|
|
108
154
|
...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"] : []),
|
|
109
155
|
"",
|
|
@@ -179,7 +225,7 @@ function keeperTools(job, memory, progress) {
|
|
|
179
225
|
].join(" ")
|
|
180
226
|
});
|
|
181
227
|
if (wording !== void 0) throw new InvalidEditError([wording]);
|
|
182
|
-
const result = await tool.execute(args, exec);
|
|
228
|
+
const result = await tool.execute(withKnownTags(args, tagUsage(job.store.story.events.list())), exec);
|
|
183
229
|
progress.edits += 1;
|
|
184
230
|
progress.unchecked = true;
|
|
185
231
|
return result;
|
|
@@ -203,6 +249,19 @@ function keeperTools(job, memory, progress) {
|
|
|
203
249
|
return tool;
|
|
204
250
|
});
|
|
205
251
|
}
|
|
252
|
+
/** The edit with the tags of its new and edited events brought onto the tags already in use. */
|
|
253
|
+
function withKnownTags(args, known) {
|
|
254
|
+
const edit = args;
|
|
255
|
+
const mapped = (entries) => entries?.map((entry) => Array.isArray(entry.tags) ? {
|
|
256
|
+
...entry,
|
|
257
|
+
tags: canonicalTags(known, entry.tags)
|
|
258
|
+
} : entry);
|
|
259
|
+
return {
|
|
260
|
+
...edit,
|
|
261
|
+
...edit.events === void 0 ? {} : { events: mapped(edit.events) },
|
|
262
|
+
...edit.event_edits === void 0 ? {} : { event_edits: mapped(edit.event_edits) }
|
|
263
|
+
};
|
|
264
|
+
}
|
|
206
265
|
/** What one request of the keeper may carry: the events and what each witness took in, for every round it was given, and the shape of the call. */
|
|
207
266
|
const KEEPER_CHARACTERS_PER_ROUND = 4e3;
|
|
208
267
|
const keeperEstimate = (rounds, language) => tokensOf(rounds * KEEPER_CHARACTERS_PER_ROUND, language) + 192;
|
|
@@ -241,7 +300,10 @@ function recordKeeper(deps) {
|
|
|
241
300
|
external: externalGiven(parent.ctx.tools, job.store.settings().tools, "records"),
|
|
242
301
|
result: RESULT$3,
|
|
243
302
|
beforeSubmit: () => {
|
|
244
|
-
if (progress.edits === 0 && !warned) {
|
|
303
|
+
if (progress.edits === 0 && !warned && job.store.story.records({ rounds: job.rounds.map(({ turn, round }) => ({
|
|
304
|
+
turn,
|
|
305
|
+
round
|
|
306
|
+
})) }).events.length === 0) {
|
|
245
307
|
warned = true;
|
|
246
308
|
return "you have written nothing: record the rounds with edit_records. If truly nothing happened, say so in notes and submit again.";
|
|
247
309
|
}
|
|
@@ -968,6 +1030,173 @@ function describeChecks(checks, tr) {
|
|
|
968
1030
|
return [tr("The checks of this story:"), ...lines].join("\n");
|
|
969
1031
|
}
|
|
970
1032
|
//#endregion
|
|
1033
|
+
//#region src/host/orchestration/check-tool.ts
|
|
1034
|
+
const CHECK_NARRATE_TOOL = "roll_and_narrate";
|
|
1035
|
+
const BRANCHES = [
|
|
1036
|
+
["succeeded", "on_success"],
|
|
1037
|
+
["partial", "on_partial"],
|
|
1038
|
+
["failed", "on_failure"]
|
|
1039
|
+
];
|
|
1040
|
+
const SUMMARY = "What concretely happens to the character, in a sentence. It becomes what the character is doing.";
|
|
1041
|
+
const NARRATION = "What the player reads: narration only, no one else speaks.";
|
|
1042
|
+
/**
|
|
1043
|
+
* The game master settles a lone attempt of the player's character in one call: it writes what comes of each way the dice may fall and the code rolls and
|
|
1044
|
+
* delivers the branch they chose. A fast path only: anything that asks characters, moves someone or handles things goes through the ordinary round.
|
|
1045
|
+
*/
|
|
1046
|
+
function createCheckNarrateTool(deps) {
|
|
1047
|
+
return defineTool({
|
|
1048
|
+
name: CHECK_NARRATE_TOOL,
|
|
1049
|
+
description: "Settle the player's own uncertain attempt in one step when nobody else needs to react and nothing moves or changes hands: write what comes of each way the check can fall, the dice are rolled for you, and the branch they choose is recorded as the round and delivered as the output, ending the turn. Give a branch for every result the check can give (list_checks shows its bands). The branches you do not get are discarded, so keep each short. When others must react, anything moves or things change hands, use roll_check, resolve_round and narrate instead.",
|
|
1050
|
+
parameters: {
|
|
1051
|
+
check: {
|
|
1052
|
+
type: "string",
|
|
1053
|
+
required: true,
|
|
1054
|
+
description: "The key of the check, as list_checks gives it."
|
|
1055
|
+
},
|
|
1056
|
+
character: {
|
|
1057
|
+
type: "string",
|
|
1058
|
+
required: true,
|
|
1059
|
+
description: "The key of the player's character."
|
|
1060
|
+
},
|
|
1061
|
+
reason: {
|
|
1062
|
+
type: "string",
|
|
1063
|
+
required: true,
|
|
1064
|
+
description: "What is attempted, in a sentence."
|
|
1065
|
+
},
|
|
1066
|
+
target: {
|
|
1067
|
+
type: "integer",
|
|
1068
|
+
description: "When the check is read against a target: the difficulty, set by how hard the attempt is. Never 0 to make it easy."
|
|
1069
|
+
},
|
|
1070
|
+
bonus: {
|
|
1071
|
+
type: "integer",
|
|
1072
|
+
description: "What the circumstances add to or take from the roll, from -10 to 10; leave out for none."
|
|
1073
|
+
},
|
|
1074
|
+
on_success: {
|
|
1075
|
+
type: "object",
|
|
1076
|
+
additionalProperties: false,
|
|
1077
|
+
description: "What happens when the attempt succeeds.",
|
|
1078
|
+
properties: {
|
|
1079
|
+
summary: {
|
|
1080
|
+
type: "string",
|
|
1081
|
+
required: true,
|
|
1082
|
+
description: SUMMARY
|
|
1083
|
+
},
|
|
1084
|
+
narration: {
|
|
1085
|
+
type: "string",
|
|
1086
|
+
required: true,
|
|
1087
|
+
description: NARRATION
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
on_partial: {
|
|
1092
|
+
type: "object",
|
|
1093
|
+
additionalProperties: false,
|
|
1094
|
+
description: "What happens when the check gives a partial result; only for a check with a partial band.",
|
|
1095
|
+
properties: {
|
|
1096
|
+
summary: {
|
|
1097
|
+
type: "string",
|
|
1098
|
+
required: true,
|
|
1099
|
+
description: SUMMARY
|
|
1100
|
+
},
|
|
1101
|
+
narration: {
|
|
1102
|
+
type: "string",
|
|
1103
|
+
required: true,
|
|
1104
|
+
description: NARRATION
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
on_failure: {
|
|
1109
|
+
type: "object",
|
|
1110
|
+
additionalProperties: false,
|
|
1111
|
+
description: "What happens when the attempt fails.",
|
|
1112
|
+
properties: {
|
|
1113
|
+
summary: {
|
|
1114
|
+
type: "string",
|
|
1115
|
+
required: true,
|
|
1116
|
+
description: SUMMARY
|
|
1117
|
+
},
|
|
1118
|
+
narration: {
|
|
1119
|
+
type: "string",
|
|
1120
|
+
required: true,
|
|
1121
|
+
description: NARRATION
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
output: {
|
|
1127
|
+
schema: { type: "json" },
|
|
1128
|
+
render: (_args, value) => {
|
|
1129
|
+
const done = value;
|
|
1130
|
+
return [{
|
|
1131
|
+
type: "text",
|
|
1132
|
+
text: `${done.roll}\nThe output has been delivered to the player. The turn ends here.\n${encodeOutput(done.output)}`
|
|
1133
|
+
}];
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
isConcurrencySafe: () => false,
|
|
1137
|
+
async execute(args, exec) {
|
|
1138
|
+
const agent = exec.agent;
|
|
1139
|
+
if (agent === void 0) throw new Error("the roleplay tools can only be called by an agent");
|
|
1140
|
+
const owner = {
|
|
1141
|
+
chat: agent.session.id,
|
|
1142
|
+
turn: deps.turnOf(agent)
|
|
1143
|
+
};
|
|
1144
|
+
await deps.engine.settle(owner.chat, owner.turn);
|
|
1145
|
+
const store = deps.stores(owner.chat);
|
|
1146
|
+
if (store === void 0) throw new Error("this chat is not a roleplay session");
|
|
1147
|
+
const check = store.story.dice.check(args.check);
|
|
1148
|
+
if (check === void 0) throw new Error(`there is no check "${args.check}"; list_checks shows the story's checks`);
|
|
1149
|
+
const problem = deps.engine.soloCheckProblem(owner, args.character);
|
|
1150
|
+
if (problem !== void 0) throw new Error(problem);
|
|
1151
|
+
const given = {
|
|
1152
|
+
succeeded: args.on_success,
|
|
1153
|
+
partial: args.on_partial,
|
|
1154
|
+
failed: args.on_failure
|
|
1155
|
+
};
|
|
1156
|
+
const missing = BRANCHES.filter(([result]) => check.bands.some((band) => band.result === result) && given[result] === void 0).map(([, name]) => name);
|
|
1157
|
+
if (missing.length > 0) throw new Error(`the check "${check.key}" can give ${[...new Set(check.bands.map((band) => band.result))].join(", ")}: give ${missing.join(" and ")} too; nothing was rolled`);
|
|
1158
|
+
const rolled = rollForCheck({
|
|
1159
|
+
session: store.story,
|
|
1160
|
+
turn: owner.turn
|
|
1161
|
+
}, {
|
|
1162
|
+
check: check.key,
|
|
1163
|
+
reason: args.reason,
|
|
1164
|
+
character: args.character,
|
|
1165
|
+
...args.target === void 0 ? {} : { target: args.target },
|
|
1166
|
+
...args.bonus === void 0 ? {} : { bonus: args.bonus }
|
|
1167
|
+
});
|
|
1168
|
+
const branch = given[rolled.result];
|
|
1169
|
+
if (branch === void 0) throw new Error(`the roll gave ${rolled.result}, for which no branch was written`);
|
|
1170
|
+
const run = characterRunner({
|
|
1171
|
+
parent: agent,
|
|
1172
|
+
boundaries: deps.boundaries,
|
|
1173
|
+
store
|
|
1174
|
+
});
|
|
1175
|
+
await deps.engine.resolve(owner, [{
|
|
1176
|
+
character: args.character,
|
|
1177
|
+
result: rolled.result,
|
|
1178
|
+
summary: branch.summary,
|
|
1179
|
+
roll: rolled.roll
|
|
1180
|
+
}], run, exec.signal);
|
|
1181
|
+
const output = await deps.engine.narrate(owner, [{
|
|
1182
|
+
type: "narration",
|
|
1183
|
+
text: branch.narration
|
|
1184
|
+
}], run, []).catch((error) => {
|
|
1185
|
+
throw new Error(`${error instanceof Error ? error.message : String(error)}. The roll (${rolled.roll}: ${rolled.result}) and the round are already recorded: do not roll again, call narrate with the output`);
|
|
1186
|
+
});
|
|
1187
|
+
const timelineNode = deps.delivered?.(owner.chat, output);
|
|
1188
|
+
exec.concludeTurn();
|
|
1189
|
+
return record({
|
|
1190
|
+
roll: rolled.text,
|
|
1191
|
+
output: timelineNode === void 0 ? output : {
|
|
1192
|
+
...output,
|
|
1193
|
+
timelineNode
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
//#endregion
|
|
971
1200
|
//#region src/host/memory/embedding-index.ts
|
|
972
1201
|
const BATCH = 32;
|
|
973
1202
|
/**
|
|
@@ -1090,6 +1319,36 @@ function rerankMemories(deps) {
|
|
|
1090
1319
|
};
|
|
1091
1320
|
}
|
|
1092
1321
|
//#endregion
|
|
1322
|
+
//#region src/host/orchestration/suggestion-fallback.ts
|
|
1323
|
+
/**
|
|
1324
|
+
* Lines made from the story's own data when the suggester could not make any, so the player is never left with an empty tray:
|
|
1325
|
+
* someone to talk to, a way out, a thing to look at, then plain standbys. No model is asked.
|
|
1326
|
+
*/
|
|
1327
|
+
function fallbackSuggestions(store, count) {
|
|
1328
|
+
const tr = translator(languageOf(store.settings().prompts.language));
|
|
1329
|
+
const player = store.cast().find((member) => member.character.control === "player");
|
|
1330
|
+
const view = player?.place === void 0 ? void 0 : store.place(player.place.location.id);
|
|
1331
|
+
const people = (view?.here ?? []).filter((member) => member.character.id !== player?.character.id).map((member) => tr("Talk to {name}.", { name: member.character.name }));
|
|
1332
|
+
const ways = (view?.exits ?? []).filter(({ exit }) => exit.state === "open").map(({ name }) => tr("Go to {place}.", { place: name }));
|
|
1333
|
+
const things = (view?.items ?? []).filter((item) => !item.hidden).map((item) => tr("Take a closer look at {thing}.", { thing: item.name }));
|
|
1334
|
+
const standbys = [
|
|
1335
|
+
tr("Look around carefully."),
|
|
1336
|
+
tr("Wait and see what happens."),
|
|
1337
|
+
tr("Ask what is going on."),
|
|
1338
|
+
tr("Think about what to do next.")
|
|
1339
|
+
];
|
|
1340
|
+
const lanes = [
|
|
1341
|
+
people,
|
|
1342
|
+
ways,
|
|
1343
|
+
things
|
|
1344
|
+
];
|
|
1345
|
+
const picked = [];
|
|
1346
|
+
for (let round = 0; picked.length < count && lanes.some((lane) => lane.length > round); round++) for (const lane of lanes) if (picked.length < count && lane[round] !== void 0) picked.push(lane[round]);
|
|
1347
|
+
for (const line of standbys) if (picked.length < count) picked.push(line);
|
|
1348
|
+
const lines = tidySuggestions(picked).map((line) => line.length > 200 ? `${line.slice(0, 199)}…` : line);
|
|
1349
|
+
return suggestionProblems(lines, count).length === 0 ? lines : [];
|
|
1350
|
+
}
|
|
1351
|
+
//#endregion
|
|
1093
1352
|
//#region src/host/orchestration/after-turn.ts
|
|
1094
1353
|
/** Something made up that has waited this many turns is fitted into the world even if few are waiting. */
|
|
1095
1354
|
const STALE_AFTER_TURNS = 4;
|
|
@@ -1544,6 +1803,10 @@ function recordRound(store, owner, state, fire) {
|
|
|
1544
1803
|
key: locationKey(playerPlace),
|
|
1545
1804
|
name: playerPlace.name
|
|
1546
1805
|
} },
|
|
1806
|
+
present: state.cast.flatMap((member) => member.place === void 0 ? [] : [{
|
|
1807
|
+
character: member.key,
|
|
1808
|
+
place: locationKey(member.place.location)
|
|
1809
|
+
}]),
|
|
1547
1810
|
time: {
|
|
1548
1811
|
from: time.from,
|
|
1549
1812
|
to: time.to,
|
|
@@ -2193,6 +2456,17 @@ var TurnEngine = class {
|
|
|
2193
2456
|
};
|
|
2194
2457
|
return recordRound(this.storeOf(owner), owner, state, (round) => this.fire(owner, round));
|
|
2195
2458
|
}
|
|
2459
|
+
/** Why a lone check of the player's character cannot be rolled, recorded and narrated in one call, if it cannot: nothing is rolled until this is clear. */
|
|
2460
|
+
soloCheckProblem(owner, character) {
|
|
2461
|
+
const state = this.stateFor(owner);
|
|
2462
|
+
const store = this.storeOf(owner);
|
|
2463
|
+
if (state.ooc !== void 0) return "this turn is an out-of-character one: use ooc_ruling or ooc_answer";
|
|
2464
|
+
if (state.phase !== "idle" || state.rounds > 0) return "characters were already played in this turn: roll with roll_check, decide with resolve_round and deliver with narrate";
|
|
2465
|
+
if (judgeDue(state) || previewDue(state)) return explainPhase(state, "resolve_round");
|
|
2466
|
+
if (state.judgement?.allowed === false) return `the action cannot work (${state.judgement.reason}): play it as a failed attempt with resolve_round, then narrate`;
|
|
2467
|
+
const player = store.cast().find((member) => member.character.control === "player");
|
|
2468
|
+
return player?.key === character ? void 0 : `this is only for the player's character${player === void 0 ? "" : ` (${player.key})`}: anyone else's attempt goes through activate_characters`;
|
|
2469
|
+
}
|
|
2196
2470
|
/** The key of the player's character. */
|
|
2197
2471
|
playerKey(state) {
|
|
2198
2472
|
return state.cast.find((member) => member.character.control === "player")?.key;
|
|
@@ -2440,11 +2714,18 @@ var TurnEngine = class {
|
|
|
2440
2714
|
spoken(owner) {
|
|
2441
2715
|
return this.stateFor(owner).utterances;
|
|
2442
2716
|
}
|
|
2443
|
-
/**
|
|
2444
|
-
|
|
2717
|
+
/**
|
|
2718
|
+
* Whether the game master may still be turned back, counting this objection. Only objections that get nowhere count: a turn that has moved on since the
|
|
2719
|
+
* last one (what is missing changed) starts the count again, because a turn cut short by a model's output limit has to be steered through every step.
|
|
2720
|
+
*/
|
|
2721
|
+
object(owner, missing) {
|
|
2445
2722
|
const key = `${owner.chat}#${owner.turn}`;
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2723
|
+
const last = this.objections.get(key);
|
|
2724
|
+
const count = last?.missing === missing ? last.count + 1 : 1;
|
|
2725
|
+
this.objections.set(key, {
|
|
2726
|
+
missing,
|
|
2727
|
+
count
|
|
2728
|
+
});
|
|
2448
2729
|
return count <= MAX_OBJECTIONS;
|
|
2449
2730
|
}
|
|
2450
2731
|
track(chat, job) {
|
|
@@ -2460,7 +2741,7 @@ var TurnEngine = class {
|
|
|
2460
2741
|
this.states.get(chat)?.cancel.abort();
|
|
2461
2742
|
this.reflectionCancels.get(chat)?.abort();
|
|
2462
2743
|
}
|
|
2463
|
-
/** Resolves when nothing of the chat writes to its story any more: the records, what was made up being fitted in, the characters away. */
|
|
2744
|
+
/** 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. */
|
|
2464
2745
|
async quiesce(chat) {
|
|
2465
2746
|
for (;;) {
|
|
2466
2747
|
const jobs = [...this.working.get(chat) ?? [], ...this.chains.has(chat) ? [this.chains.get(chat)] : []];
|
|
@@ -2536,7 +2817,7 @@ var TurnEngine = class {
|
|
|
2536
2817
|
if (waiting === 0) throw new Error("nothing is waiting to be recorded: the rounds so far are already in the story's records");
|
|
2537
2818
|
if (focus !== void 0 && focus.trim() !== "") state.focus.push(focus.trim());
|
|
2538
2819
|
state.requested = true;
|
|
2539
|
-
this.write(owner, state);
|
|
2820
|
+
if (this.storeOf(owner).settings().background.concurrent) this.write(owner, state);
|
|
2540
2821
|
return waiting;
|
|
2541
2822
|
}
|
|
2542
2823
|
/** How many recorded rounds wait for their memory to be written. */
|
|
@@ -2586,7 +2867,7 @@ var TurnEngine = class {
|
|
|
2586
2867
|
const store = this.stores(owner.chat);
|
|
2587
2868
|
const count = store?.settings().suggestions.count ?? 0;
|
|
2588
2869
|
if (store === void 0 || count === 0) return;
|
|
2589
|
-
this.boundaries().suggester.suggest({
|
|
2870
|
+
this.track(owner.chat, this.boundaries().suggester.suggest({
|
|
2590
2871
|
chat: owner.chat,
|
|
2591
2872
|
turn: owner.turn,
|
|
2592
2873
|
store,
|
|
@@ -2603,8 +2884,20 @@ var TurnEngine = class {
|
|
|
2603
2884
|
lines
|
|
2604
2885
|
});
|
|
2605
2886
|
}).catch((error) => {
|
|
2606
|
-
if (
|
|
2607
|
-
|
|
2887
|
+
if (state.cancel.signal.aborted) return;
|
|
2888
|
+
this.problem(`suggestions for turn ${owner.turn} were not made: ${error instanceof Error ? error.message : String(error)}`);
|
|
2889
|
+
if (this.states.get(owner.chat) !== state) return;
|
|
2890
|
+
try {
|
|
2891
|
+
const lines = fallbackSuggestions(store, count);
|
|
2892
|
+
if (lines.length > 0) store.putNote({
|
|
2893
|
+
kind: "suggestions",
|
|
2894
|
+
turn: owner.turn,
|
|
2895
|
+
lines
|
|
2896
|
+
});
|
|
2897
|
+
} catch (failed) {
|
|
2898
|
+
this.problem(`suggestions for turn ${owner.turn} could not be made from the story either: ${failed instanceof Error ? failed.message : String(failed)}`);
|
|
2899
|
+
}
|
|
2900
|
+
}));
|
|
2608
2901
|
}
|
|
2609
2902
|
/** After the output is delivered: start writing what is due, without waiting for it. */
|
|
2610
2903
|
startDueWrite(owner, state) {
|
|
@@ -2978,7 +3271,7 @@ function apply(ctx) {
|
|
|
2978
3271
|
return resourceHint(ctx.tools.schemas(context.scope).map((tool) => tool.name), ctx.tools.schemas().map((tool) => tool.name), translator(languageOf(chat?.settings.prompts.language ?? "en")));
|
|
2979
3272
|
}
|
|
2980
3273
|
});
|
|
2981
|
-
const
|
|
3274
|
+
const toolDeps = {
|
|
2982
3275
|
engine,
|
|
2983
3276
|
boundaries,
|
|
2984
3277
|
stores,
|
|
@@ -2988,7 +3281,8 @@ function apply(ctx) {
|
|
|
2988
3281
|
if (node !== void 0) images.afterDelivery(chat, node, output);
|
|
2989
3282
|
return node;
|
|
2990
3283
|
}
|
|
2991
|
-
}
|
|
3284
|
+
};
|
|
3285
|
+
const [previewTool, ...tools] = [...createTools$1(toolDeps)].sort((a, b) => Number(b.name === PREVIEW_TOOL) - Number(a.name === PREVIEW_TOOL));
|
|
2992
3286
|
for (const tool of tools) ctx.tools.register(tool);
|
|
2993
3287
|
ctx.effect(() => {
|
|
2994
3288
|
ctx.roleplayOrchestration.reflect = (chat) => engine.reflect(chat);
|
|
@@ -3064,7 +3358,7 @@ function apply(ctx) {
|
|
|
3064
3358
|
stores,
|
|
3065
3359
|
timelines,
|
|
3066
3360
|
previewTool,
|
|
3067
|
-
optionalTools: createDiceTools(diceLink)
|
|
3361
|
+
optionalTools: [...createDiceTools(diceLink), createCheckNarrateTool(toolDeps)]
|
|
3068
3362
|
});
|
|
3069
3363
|
}
|
|
3070
3364
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { $ as LOCATION_FILE_NAME, A as loadTriggers, At as parseLoreFile, B as loadItems, C as populateLocations, D as populateVariables, Dt as LORE_DIR, F as loadCalendar, G as extractStyleFrom, H as loadFactions, J as withPlayer, L as LOCATIONS_DIR, Mt as InvalidEditProblems, Ot as loadLore, R as loadLocations, U as CHARACTERS_DIR, V as FACTIONS_DIR, W as loadCharacters, X as loadVariables, _ as populateCharacters, at as CHARACTER_FILE_NAME, c as authoredWorldOf, dt as WORLD_FILE_NAME, et as parseLocationFile, ft as parseWorldFile, h as knowsCharacter, i as contextOf, it as parseFactionFile, jt as subfolders, k as TRIGGERS_FILE_NAME, kt as LORE_FILE_NAME, m as loadValidatedWorld, nt as parseItemFile, ot as parseCharacterFile, rt as FACTION_FILE_NAME, s as worldOf, st as IMPORT_FOLDER, tt as ITEM_FILE_NAME, x as populateItems, z as ITEMS_DIR } from "./authoring-tools-
|
|
2
|
-
import { v as writeWorldPrompt } from "./presets-
|
|
3
|
-
import { f as parseSwitchboard } from "./narration-
|
|
4
|
-
import {
|
|
1
|
+
import { $ as LOCATION_FILE_NAME, A as loadTriggers, At as parseLoreFile, B as loadItems, C as populateLocations, D as populateVariables, Dt as LORE_DIR, F as loadCalendar, G as extractStyleFrom, H as loadFactions, J as withPlayer, L as LOCATIONS_DIR, Mt as InvalidEditProblems, Ot as loadLore, R as loadLocations, U as CHARACTERS_DIR, V as FACTIONS_DIR, W as loadCharacters, X as loadVariables, _ as populateCharacters, at as CHARACTER_FILE_NAME, c as authoredWorldOf, dt as WORLD_FILE_NAME, et as parseLocationFile, ft as parseWorldFile, h as knowsCharacter, i as contextOf, it as parseFactionFile, jt as subfolders, k as TRIGGERS_FILE_NAME, kt as LORE_FILE_NAME, m as loadValidatedWorld, nt as parseItemFile, ot as parseCharacterFile, rt as FACTION_FILE_NAME, s as worldOf, st as IMPORT_FOLDER, tt as ITEM_FILE_NAME, x as populateItems, z as ITEMS_DIR } from "./authoring-tools-C2BHkEFP.js";
|
|
2
|
+
import { v as writeWorldPrompt } from "./presets-Dc15L6OU.js";
|
|
3
|
+
import { f as parseSwitchboard } from "./narration-DstnwrvX.js";
|
|
4
|
+
import { B as parsePlotsFile, F as isStoryLanguage, I as textLanguage, N as LANGUAGE_NAMES, P as STORY_LANGUAGES, R as PLOTS_FILE_NAME, V as plotReferenceProblems, W as formatIssue, et as shippedLanguages, it as InvalidWorldError, q as PROMPTS_FOLDER, z as loadPlots } from "./hooks-CHmUksFS.js";
|
|
5
5
|
import { s as parseSampling } from "./child-DsixtqTw.js";
|
|
6
6
|
import { c as referenceImagePath, v as mapLimit } from "./library-COIktKBa.js";
|
|
7
|
-
import { n as readPreset } from "./preset-
|
|
8
|
-
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-
|
|
7
|
+
import { n as readPreset } from "./preset-BL1d40oG.js";
|
|
8
|
+
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-DB_9xiCp.js";
|
|
9
9
|
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
|
|
10
10
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
@@ -2134,4 +2134,4 @@ function registerPackJail(ctx, deps) {
|
|
|
2134
2134
|
//#endregion
|
|
2135
2135
|
export { worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile$1 as E, loadWorldParts as F, translateTools as H, PRESET_FILE as I, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, 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, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
|
|
2136
2136
|
|
|
2137
|
-
//# sourceMappingURL=pack-jail-
|
|
2137
|
+
//# sourceMappingURL=pack-jail-CEDDI4Xw.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as Reader } from "./hooks-CHmUksFS.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";
|
|
@@ -840,4 +840,4 @@ function anyTab(bases) {
|
|
|
840
840
|
//#endregion
|
|
841
841
|
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 };
|
|
842
842
|
|
|
843
|
-
//# sourceMappingURL=packs-
|
|
843
|
+
//# sourceMappingURL=packs-DB_9xiCp.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as ImportCardError, K as cleanText, r as MAX_PREVIEW_TEXT } from "./authoring-tools-
|
|
1
|
+
import { Bt as ImportCardError, K as cleanText, r as MAX_PREVIEW_TEXT } from "./authoring-tools-C2BHkEFP.js";
|
|
2
2
|
import { o as SAMPLING_RANGES } from "./child-DsixtqTw.js";
|
|
3
3
|
//#region src/host/import/preset.ts
|
|
4
4
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
239
239
|
//#endregion
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-BL1d40oG.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as extractStyleFrom, J as withPlayer, i as contextOf, st as IMPORT_FOLDER } from "./authoring-tools-
|
|
2
|
-
import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-
|
|
3
|
-
import {
|
|
4
|
-
import { n as readPreset$1 } from "./preset-
|
|
1
|
+
import { G as extractStyleFrom, J as withPlayer, i as contextOf, st as IMPORT_FOLDER } from "./authoring-tools-C2BHkEFP.js";
|
|
2
|
+
import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-Dc15L6OU.js";
|
|
3
|
+
import { Z as languageOf, et as shippedLanguages, tt as shippedPromptsDirectory } from "./hooks-CHmUksFS.js";
|
|
4
|
+
import { n as readPreset$1 } from "./preset-BL1d40oG.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
@@ -273,4 +273,4 @@ async function presetApproval(exec, next, carries) {
|
|
|
273
273
|
//#endregion
|
|
274
274
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
275
275
|
|
|
276
|
-
//# sourceMappingURL=preset-author-tools-
|
|
276
|
+
//# sourceMappingURL=preset-author-tools-B2wZXKZo.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { c as presetDirectory } from "./presets-
|
|
3
|
-
import "./hooks-
|
|
4
|
-
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-C2BHkEFP.js";
|
|
2
|
+
import { c as presetDirectory } from "./presets-Dc15L6OU.js";
|
|
3
|
+
import "./hooks-CHmUksFS.js";
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-B2wZXKZo.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
//#region src/preset-authoring.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as promptProblem, K as LANGUAGE_FOLDER, Q as listFiles, Z as languageOf, et as shippedLanguages, q as PROMPTS_FOLDER, tt as shippedPromptsDirectory } from "./hooks-CHmUksFS.js";
|
|
2
2
|
import { s as parseSampling } from "./child-DsixtqTw.js";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
@@ -354,4 +354,4 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
|
|
|
354
354
|
//#endregion
|
|
355
355
|
export { readWorldPrompt as _, isPresetName as a, INTENT_STATUSES as b, presetDirectory as c, savePresetFromWorld as d, sha as f, listWorldPrompts as g, deleteWorldPrompt as h, deletePreset as i, readPreset as l, PROSE_PROMPTS as m, createPresetFromGuidance as n, listPresets as o, updatePresetInfo as p, createPresetFromShipped as r, loadPreset as s, PRESET_FILE as t, reservePreset as u, writeWorldPrompt as v, INTENT_TYPES as x, INTENT_HORIZONS as y };
|
|
356
356
|
|
|
357
|
-
//# sourceMappingURL=presets-
|
|
357
|
+
//# sourceMappingURL=presets-Dc15L6OU.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
|
|
2
|
-
import { f as sha, o as listPresets, s as loadPreset } from "./presets-
|
|
3
|
-
import "./narration-
|
|
4
|
-
import {
|
|
2
|
+
import { f as sha, o as listPresets, s as loadPreset } from "./presets-Dc15L6OU.js";
|
|
3
|
+
import "./narration-DstnwrvX.js";
|
|
4
|
+
import { E as describeWhen, L as wrongLanguage, T as describeTime, X as inheritPrompts, k as answerLimits, lt as languageOf, q as PROMPTS_FOLDER, ut as translator } from "./hooks-CHmUksFS.js";
|
|
5
5
|
import { a as runChild, h as trimCharacters, i as childTrace, n as childSampling, p as estimateAnswer, t as childModel } from "./child-DsixtqTw.js";
|
|
6
6
|
import { a as inheritImages } from "./library-COIktKBa.js";
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
7
|
+
import { i as inheritPacks } from "./packs-DB_9xiCp.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
@@ -1996,4 +1996,4 @@ function memoryReflector(deps) {
|
|
|
1996
1996
|
//#endregion
|
|
1997
1997
|
export { whereabouts as a, copyPreset as c, switchPreset as d, readTimeline as f, referent as g, sameWords as h, reflectionStatus as i, presetStatus as l, defaultBoundaries as m, memoryReflector as n, TimelineError as o, pathTo as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u };
|
|
1998
1998
|
|
|
1999
|
-
//# sourceMappingURL=reflection-
|
|
1999
|
+
//# sourceMappingURL=reflection-BWMVdHhR.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@dsh-agentic-roleplay/state": "0.4.
|
|
80
|
+
"@dsh-agentic-roleplay/state": "0.4.1",
|
|
81
81
|
"@dsh-ai-providers/core": "^0.1.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
@@ -3,12 +3,12 @@ You are the record keeper of an interactive story. You turn what was decided in
|
|
|
3
3
|
You work only from the material you are given and from what your tools show. You never infer, guess, embellish or add anything that is not stated there; when something is not stated, you leave it out. You write no story text and decide nothing: what happened has already been decided. Write the text of every event, perception, belief and thread in ${language}, whatever language the material or the character sheets are in; keep names as they are written.
|
|
4
4
|
|
|
5
5
|
You work in a loop with your tools:
|
|
6
|
-
1.
|
|
7
|
-
2. Check your work when the prompt says verification is on: read the records back with read_records for those rounds and compare them with the rounds, item by item: an event the rounds do not support (correct or retract it: only events
|
|
6
|
+
1. What each character did and said in the rounds due is already written as plain events, listed with their ids under "Already recorded for these rounds"; an utterance is one of them, word for word. Never write those again and never change the words of a quoted utterance. Make them better with edit_records: event_edits to set the importance, the tags and who is involved, and to correct who perceived them and how (a bystander who only glimpsed it, or took it in wrongly); new events only for what the rounds establish that no listed event covers (a revelation, a consequence, a change); and the rest below. One call may hold state changes, events, beliefs and threads together; it is applied entirely or not at all. If it is refused, the reasons come back: correct them and call again.
|
|
7
|
+
2. Check your work when the prompt says verification is on: read the records back with read_records for those rounds and compare them with the rounds, item by item: an event the rounds do not support (correct or retract it: only events that are still drafts, which are the ones written for these rounds, can be corrected); something clearly stated and missing (add it); two events saying the same thing (retract the later); a perception by someone who could not have perceived the event, or missing for the character who did or said it; a character state that is a log of events or leaks a private thought into public_state; a belief the rounds do not support (retract it); an importance clearly out of proportion. Fix what you find with edit_records (event_edits, event_retractions, belief_edits, belief_retractions, new events) and read again. Do not change wording for style.
|
|
8
8
|
3. Finish with submit_result.
|
|
9
9
|
|
|
10
10
|
What to write:
|
|
11
|
-
- events: one for each distinct thing that happened (an action, a statement that matters, a revelation, a change), in the past tense ("Bob took the key."), one sentence, no interpretation, no narration. Never repeat an event that is already recorded. Usually
|
|
11
|
+
- events: one for each distinct thing that happened (an action, a statement that matters, a revelation, a change), in the past tense ("Bob took the key."), one sentence, no interpretation, no narration. Never repeat an event that is already recorded. Usually none to three new ones per round, since the actions and the words are already there. Give each its turn and round, its tags and the characters it involves. Tags are lowercase words (objects, places, topics): choose from the tags listed under "Tags already in use", and make a new tag only when none of them fits.
|
|
12
12
|
- importance: 1 a passing detail, 2 minor, 3 notable, 4 important, 5 turns the story. Most events are 2 or 3.
|
|
13
13
|
- perceived_by: only characters who could actually perceive the event, each once, with how (witnessed, heard, told, inferred). The character who does or says something always perceives it. A character who was not there does not.
|
|
14
14
|
- The rounds you are given may be several, from this turn and earlier ones, because the game master records only when the story moves on. Write each event at the turn and round it belongs to. Routine rounds (small talk, movement) do not each need an event: fold them into the event that matters, or leave them out. If the game master named what is worth keeping, write that first.
|