@dsh-agentic-roleplay/core 0.3.0 → 0.3.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/lib/authoring.js +18 -223
- package/lib/client.js +1838 -489
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +1 -1
- package/lib/deliver-BSsDtF6X.js +3443 -0
- package/lib/{documents-7GMc5NnW.js → documents-B5XAdfo2.js} +992 -14
- package/lib/{gallery-DUeBMHQX.js → gallery-DS5-qH9F.js} +2 -2
- package/lib/{generator-HPifO3Kk.js → generator-BzeepLd2.js} +3 -3
- package/lib/images.js +3 -3
- package/lib/index.js +351 -13
- package/lib/narration-DK2kiIjE.js +141 -0
- package/lib/orchestration.js +867 -1547
- package/lib/{packs-alJTiDM2.js → packs-BCGK9KZV.js} +51 -7
- package/lib/{presenter-agent-PX1WVaJB.js → presenter-agent-Cp-J0onD.js} +3 -3
- package/lib/{narration-CKZTk5UE.js → settings-CA6icLL_.js} +158 -142
- package/package.json +4 -4
- package/packs/scene/strip.js +1 -1
- package/prompts/en/roleplay/character-decide.md +1 -1
- package/prompts/en/roleplay/character-rules.md +1 -1
- package/prompts/en/roleplay/chronicler.md +1 -1
- package/prompts/en/roleplay/dice.md +7 -0
- package/prompts/en/roleplay/game-master.md +3 -1
- package/prompts/en/roleplay/reflection.md +4 -2
- package/prompts/en/roleplay/style.md +1 -1
- package/prompts/en/roleplay/suggester.md +1 -1
- package/prompts/en/translate/document.md +6 -0
- package/prompts/en/translate/glossary.md +5 -0
- package/prompts/en/translate/notice.md +2 -0
- package/prompts/zh/roleplay/character-decide.md +1 -1
- package/prompts/zh/roleplay/character-rules.md +1 -1
- package/prompts/zh/roleplay/chronicler.md +1 -1
- package/prompts/zh/roleplay/dice.md +7 -0
- package/prompts/zh/roleplay/game-master.md +3 -1
- package/prompts/zh/roleplay/reflection.md +4 -2
- package/prompts/zh/roleplay/style.md +1 -1
- package/prompts/zh/roleplay/suggester.md +1 -1
- package/prompts/zh/translate/document.md +6 -0
- package/prompts/zh/translate/glossary.md +5 -0
- package/prompts/zh/translate/notice.md +2 -0
- package/lib/deliver--uMhC6oO.js +0 -1878
- package/lib/src-CWTNeL6Y.js +0 -128
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./settings-CA6icLL_.js";
|
|
2
2
|
import { dirname, extname, join, posix, sep } from "node:path";
|
|
3
3
|
import { copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync } from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -89,7 +89,16 @@ function languageOf(tag) {
|
|
|
89
89
|
if (!LANGUAGE.test(primary)) throw new Error(`"${tag}" is not a language`);
|
|
90
90
|
return primary;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
/** How a language is named inside a prompt, for the instruction to write in it. */
|
|
93
|
+
const LANGUAGE_NAMES$1 = {
|
|
94
|
+
en: "English",
|
|
95
|
+
zh: "中文"
|
|
96
|
+
};
|
|
97
|
+
function fill(id, text, given, tag) {
|
|
98
|
+
const variables = {
|
|
99
|
+
language: LANGUAGE_NAMES$1[tag] ?? tag,
|
|
100
|
+
...given
|
|
101
|
+
};
|
|
93
102
|
return text.trim().replace(/^\$\{([A-Za-z]+)\}[ \t]*(\r?\n|$)/gm, (match, name) => variables[name] === "" ? "" : match).replace(VARIABLE, (_match, name) => {
|
|
94
103
|
const value = variables[name];
|
|
95
104
|
if (value === void 0) throw new Error(`prompt ${id} uses \${${name}}, which is not given a value (given: ${Object.keys(variables).join(", ") || "none"})`);
|
|
@@ -98,7 +107,7 @@ function fill(id, text, variables) {
|
|
|
98
107
|
}
|
|
99
108
|
/** A prompt as the package ships it, without a roleplay root: for code that has none, such as tests. */
|
|
100
109
|
function shippedText(id, language = "en", variables = {}) {
|
|
101
|
-
return fill(id, readFileSync(join(shippedPromptsDirectory(), language, `${id}.md`), "utf8"), variables);
|
|
110
|
+
return fill(id, readFileSync(join(shippedPromptsDirectory(), language, `${id}.md`), "utf8"), variables, language);
|
|
102
111
|
}
|
|
103
112
|
function listFiles(directory, prefix = "") {
|
|
104
113
|
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
@@ -138,7 +147,7 @@ var PromptLibrary = class extends Service {
|
|
|
138
147
|
if (!ID$1.test(id)) throw new Error(`"${id}" is not a prompt id`);
|
|
139
148
|
const tag = languageOf(language);
|
|
140
149
|
const own = session === void 0 ? void 0 : this.override(id, tag, session);
|
|
141
|
-
return fill(id, readFileSync(own ?? this.file(id, tag), "utf8"), variables);
|
|
150
|
+
return fill(id, readFileSync(own ?? this.file(id, tag), "utf8"), variables, tag);
|
|
142
151
|
}
|
|
143
152
|
override(id, language, session) {
|
|
144
153
|
if (!SESSION_ID.test(session)) throw new Error(`"${session}" is not a session id`);
|
|
@@ -356,7 +365,7 @@ var Reader = class Reader {
|
|
|
356
365
|
});
|
|
357
366
|
}
|
|
358
367
|
child(key) {
|
|
359
|
-
return this.path === "" ? key : `${this.path}.${key}`;
|
|
368
|
+
return this.path === "" ? key : key === "" ? this.path : `${this.path}.${key}`;
|
|
360
369
|
}
|
|
361
370
|
};
|
|
362
371
|
//#endregion
|
|
@@ -498,6 +507,41 @@ function plotReferenceProblems(plots, entities) {
|
|
|
498
507
|
return plots.flatMap((plot) => plot.participants.filter((participant) => !known.has(participant)).map((participant) => `plot "${plot.id}" names unknown participant "${participant}"`));
|
|
499
508
|
}
|
|
500
509
|
//#endregion
|
|
510
|
+
//#region src/host/translate/language.ts
|
|
511
|
+
const STORY_LANGUAGES = ["en", "zh"];
|
|
512
|
+
/** Less than this many letters of either script is too little to tell a language. */
|
|
513
|
+
const MIN_LETTERS = 20;
|
|
514
|
+
/** A text is Chinese when this share of its Han and Latin letters is Han: names in the other script do not decide it. */
|
|
515
|
+
const HAN_SHARE = .3;
|
|
516
|
+
const count = (text, pattern) => text.match(pattern)?.length ?? 0;
|
|
517
|
+
/** The language a text is written in, by the script of its letters; nothing when there is too little text to tell. */
|
|
518
|
+
function textLanguage(text) {
|
|
519
|
+
const han = count(text, /\p{Script=Han}/gu);
|
|
520
|
+
const latin = count(text, /\p{Script=Latin}/gu);
|
|
521
|
+
if (han + latin < MIN_LETTERS) return void 0;
|
|
522
|
+
return han / (han + latin) >= HAN_SHARE ? "zh" : "en";
|
|
523
|
+
}
|
|
524
|
+
const isStoryLanguage = (value) => value === "en" || value === "zh";
|
|
525
|
+
const LANGUAGE_NAMES = {
|
|
526
|
+
en: {
|
|
527
|
+
en: "English",
|
|
528
|
+
zh: "英文"
|
|
529
|
+
},
|
|
530
|
+
zh: {
|
|
531
|
+
en: "Chinese",
|
|
532
|
+
zh: "中文"
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
/** What is wrong with texts that should be in the chat's language but are written in the other one; nothing when they are right, too short to tell, or the language is not one we can read. */
|
|
536
|
+
function wrongLanguage(wanted, texts) {
|
|
537
|
+
if (!isStoryLanguage(wanted)) return void 0;
|
|
538
|
+
const wrong = Object.entries(texts).flatMap(([name, text]) => {
|
|
539
|
+
const found = text === void 0 ? void 0 : textLanguage(text);
|
|
540
|
+
return found === void 0 || found === wanted ? [] : [`${name} is written in ${LANGUAGE_NAMES[found].en}`];
|
|
541
|
+
});
|
|
542
|
+
return wrong.length === 0 ? void 0 : `${wrong.join(" and ")}: write it in ${LANGUAGE_NAMES[wanted].en} (${LANGUAGE_NAMES[wanted][wanted]})`;
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
501
545
|
//#region src/shared/worlds.ts
|
|
502
546
|
/** Path prefix of the plugin's HTTP API. Relative, so a mounted deployment resolves it against the page. */
|
|
503
547
|
const API_PREFIX = "roleplay-api";
|
|
@@ -1331,6 +1375,6 @@ function anyTab(bases) {
|
|
|
1331
1375
|
}));
|
|
1332
1376
|
}
|
|
1333
1377
|
//#endregion
|
|
1334
|
-
export {
|
|
1378
|
+
export { formatIssue as A, shippedText as B, PLOTS_FILE_NAME as C, readDocument as D, plotReferenceProblems as E, languageOf as F, SessionArchivedError as G, InvalidStartError as H, listFiles as I, INTENT_HORIZONS as J, SessionNotFoundError as K, promptProblem as L, PromptLibrary as M, copyWorldPrompts as N, errorMessage as O, inheritPrompts as P, shippedLanguages as R, wrongLanguage as S, parsePlotsFile as T, InvalidWorldError as U, AgentUnavailableError as V, ReflectionRefusedError as W, INTENT_TYPES as X, INTENT_STATUSES as Y, API_PREFIX as _, packIds as a, isStoryLanguage as b, describePack as c, packPath as d, readPack as f, SURFACE_NAMES as g, PACK_MEDIA_TYPES as h, inheritPacks as i, PROMPTS_FOLDER as j, Reader as k, isPackId as l, PACK_LIMITS as m, anyTab as n, syncWorldPacks as o, PACK_ACTIONS as p, WorldNotFoundError as q, copyWorldPacks as r, worldPackStates as s, activePack as t, packFile as u, LANGUAGE_NAMES as v, loadPlots as w, textLanguage as x, STORY_LANGUAGES as y, shippedPromptsDirectory as z };
|
|
1335
1379
|
|
|
1336
|
-
//# sourceMappingURL=packs-
|
|
1380
|
+
//# sourceMappingURL=packs-BCGK9KZV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as promptFor } from "./access-EbNdZFbk.js";
|
|
2
|
-
import { A as runChild, d as nextSceneSerial, n as generateTransientImage, p as referenceImagePath, t as generateReferenceImage } from "./generator-
|
|
3
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
2
|
+
import { A as runChild, d as nextSceneSerial, n as generateTransientImage, p as referenceImagePath, t as generateReferenceImage } from "./generator-BzeepLd2.js";
|
|
3
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-DS5-qH9F.js";
|
|
4
4
|
import { dirname, join, relative } from "node:path";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -850,4 +850,4 @@ async function runImagePresenter(job) {
|
|
|
850
850
|
//#endregion
|
|
851
851
|
export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
|
|
852
852
|
|
|
853
|
-
//# sourceMappingURL=presenter-agent-
|
|
853
|
+
//# sourceMappingURL=presenter-agent-Cp-J0onD.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import "./src-CWTNeL6Y.js";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { existsSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
4
1
|
//#region ../dsh-roleplay-model/src/clock.ts
|
|
5
2
|
/**
|
|
6
3
|
* How the story's time passes: `simulated` moves only when the story does (the game master says how
|
|
@@ -8,6 +5,131 @@ import { existsSync, readFileSync, renameSync, statSync, writeFileSync } from "n
|
|
|
8
5
|
*/
|
|
9
6
|
const CLOCK_MODES = ["simulated", "real"];
|
|
10
7
|
//#endregion
|
|
8
|
+
//#region ../dsh-roleplay-model/src/variable.ts
|
|
9
|
+
/** What a variable holds: a number within bounds, a yes or no, or one of a list of words. */
|
|
10
|
+
const VARIABLE_KINDS = [
|
|
11
|
+
"number",
|
|
12
|
+
"flag",
|
|
13
|
+
"choice"
|
|
14
|
+
];
|
|
15
|
+
/** What a variable is about: each character, item or place has its own value; `world` has one value for the whole story. */
|
|
16
|
+
const VARIABLE_SUBJECTS = [
|
|
17
|
+
"character",
|
|
18
|
+
"item",
|
|
19
|
+
"location",
|
|
20
|
+
"world"
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Who can tell what the value is. `public`: anyone present (what shows). `private`: the character it belongs to, and the
|
|
24
|
+
* game master (what it feels or knows of itself). `hidden`: only the game master and the record keeper.
|
|
25
|
+
*/
|
|
26
|
+
const VARIABLE_VISIBILITIES = [
|
|
27
|
+
"public",
|
|
28
|
+
"private",
|
|
29
|
+
"hidden"
|
|
30
|
+
];
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
key: "valence",
|
|
34
|
+
name: "Valence",
|
|
35
|
+
description: "How pleasant its mood is: -1 very unpleasant, 0 neutral, 1 very pleasant.",
|
|
36
|
+
labels: [
|
|
37
|
+
{
|
|
38
|
+
upTo: -.6,
|
|
39
|
+
label: "miserable"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
upTo: -.25,
|
|
43
|
+
label: "unhappy"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
upTo: .25,
|
|
47
|
+
label: "even"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
upTo: .6,
|
|
51
|
+
label: "pleased"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
upTo: 1,
|
|
55
|
+
label: "delighted"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: "arousal",
|
|
61
|
+
name: "Arousal",
|
|
62
|
+
description: "How worked up it is: -1 drowsy, 0 ordinary, 1 frantic.",
|
|
63
|
+
labels: [
|
|
64
|
+
{
|
|
65
|
+
upTo: -.6,
|
|
66
|
+
label: "drowsy"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
upTo: -.25,
|
|
70
|
+
label: "calm"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
upTo: .25,
|
|
74
|
+
label: "alert"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
upTo: .6,
|
|
78
|
+
label: "keyed up"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
upTo: 1,
|
|
82
|
+
label: "frantic"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: "dominance",
|
|
88
|
+
name: "Dominance",
|
|
89
|
+
description: "How much in control it feels: -1 helpless, 0 even, 1 commanding.",
|
|
90
|
+
labels: [
|
|
91
|
+
{
|
|
92
|
+
upTo: -.6,
|
|
93
|
+
label: "helpless"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
upTo: -.25,
|
|
97
|
+
label: "uneasy"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
upTo: .25,
|
|
101
|
+
label: "steady"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
upTo: .6,
|
|
105
|
+
label: "confident"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
upTo: 1,
|
|
109
|
+
label: "commanding"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
].map(({ labels, ...rest }) => ({
|
|
114
|
+
...rest,
|
|
115
|
+
kind: "number",
|
|
116
|
+
subject: "character",
|
|
117
|
+
only: [],
|
|
118
|
+
min: -1,
|
|
119
|
+
max: 1,
|
|
120
|
+
integer: false,
|
|
121
|
+
options: [],
|
|
122
|
+
default: 0,
|
|
123
|
+
baseline: true,
|
|
124
|
+
visibility: "private",
|
|
125
|
+
bands: labels.map((band) => ({
|
|
126
|
+
upTo: band.upTo,
|
|
127
|
+
label: band.label
|
|
128
|
+
})),
|
|
129
|
+
always: false,
|
|
130
|
+
builtin: true
|
|
131
|
+
}));
|
|
132
|
+
//#endregion
|
|
11
133
|
//#region src/shared/rules.ts
|
|
12
134
|
/** The key under which a session keeps the rules of its world, which it copies at the start so that it stays whole without the world's files. */
|
|
13
135
|
const WORLD_RULES_KEY = "rules";
|
|
@@ -37,6 +159,7 @@ const record = () => ({
|
|
|
37
159
|
kind: "record",
|
|
38
160
|
fallback: {}
|
|
39
161
|
});
|
|
162
|
+
const switchboard = () => ({ kind: "switchboard" });
|
|
40
163
|
const choice = (options, fallback) => ({
|
|
41
164
|
kind: "choice",
|
|
42
165
|
options,
|
|
@@ -59,7 +182,8 @@ const SETTINGS_SPEC = {
|
|
|
59
182
|
backlogRounds: integer(1, 100, 6),
|
|
60
183
|
overRetrieve: integer(1, 10, 4),
|
|
61
184
|
associate: integer(0, 10, 2),
|
|
62
|
-
diversity: ratio(0, 1, .3)
|
|
185
|
+
diversity: ratio(0, 1, .3),
|
|
186
|
+
foldedFade: ratio(.05, 1, .5)
|
|
63
187
|
},
|
|
64
188
|
context: {
|
|
65
189
|
limitTokens: integer(0, 1e6, 0),
|
|
@@ -149,11 +273,13 @@ const SETTINGS_SPEC = {
|
|
|
149
273
|
interpreterModel: text(200, ""),
|
|
150
274
|
captioner: text(200, "")
|
|
151
275
|
},
|
|
276
|
+
dice: { visibility: choice(["hidden", "card"], "card") },
|
|
277
|
+
tools: switchboard(),
|
|
152
278
|
embedding: { options: record() }
|
|
153
279
|
};
|
|
154
280
|
const isField = (spec) => "kind" in spec && typeof spec["kind"] === "string";
|
|
155
281
|
function defaultsOf(spec) {
|
|
156
|
-
return Object.fromEntries(Object.entries(spec).map(([key, entry]) => [key, isField(entry) ? entry.kind === "record" ? { ...entry.fallback } : entry.fallback : defaultsOf(entry)]));
|
|
282
|
+
return Object.fromEntries(Object.entries(spec).map(([key, entry]) => [key, isField(entry) ? entry.kind === "record" ? { ...entry.fallback } : entry.kind === "switchboard" ? {} : entry.fallback : defaultsOf(entry)]));
|
|
157
283
|
}
|
|
158
284
|
const DEFAULT_SETTINGS = defaultsOf(SETTINGS_SPEC);
|
|
159
285
|
/** Whether a name is a time zone the runtime knows. */
|
|
@@ -169,6 +295,8 @@ function isTimeZone(zone) {
|
|
|
169
295
|
/** A model as `provider/model`: both parts present, no spaces. */
|
|
170
296
|
const MODEL_NAME = /^[^\s/]+\/\S+$/;
|
|
171
297
|
const OPTION_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
298
|
+
/** What tools registered by other plugins are named: letters, digits and `_ . : -`, as MCP servers and others name theirs. */
|
|
299
|
+
const TOOL_NAME = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,79}$/;
|
|
172
300
|
/** The options, or what is wrong with them. */
|
|
173
301
|
function parseOptions(value, name) {
|
|
174
302
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return `"${name}" must be an object`;
|
|
@@ -178,6 +306,23 @@ function parseOptions(value, name) {
|
|
|
178
306
|
if (bad !== void 0) return `"${name}.${bad[0]}" must be a number, text or true/false, under a name of letters, digits and underscores`;
|
|
179
307
|
return Object.fromEntries(entries);
|
|
180
308
|
}
|
|
309
|
+
/** The switches, or what is wrong with them. Names are not checked against any list: what this version does not know is kept for the version that does. */
|
|
310
|
+
function parseSwitchboard(value, name) {
|
|
311
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return `"${name}" must be an object`;
|
|
312
|
+
const agents = Object.entries(value);
|
|
313
|
+
if (agents.length > 20) return `"${name}" may name at most 20 kinds of agent`;
|
|
314
|
+
const result = {};
|
|
315
|
+
for (const [agent, switches] of agents) {
|
|
316
|
+
if (!OPTION_NAME.test(agent)) return `"${name}.${agent}" is not a name of letters, digits and underscores`;
|
|
317
|
+
if (typeof switches !== "object" || switches === null || Array.isArray(switches)) return `"${name}.${agent}" must be an object`;
|
|
318
|
+
const entries = Object.entries(switches);
|
|
319
|
+
if (entries.length > 300) return `"${name}.${agent}" may name at most 300 tools`;
|
|
320
|
+
const bad = entries.find(([tool, on]) => !TOOL_NAME.test(tool) || typeof on !== "boolean");
|
|
321
|
+
if (bad !== void 0) return `"${name}.${agent}.${bad[0]}" must be true or false, under a tool's name (letters, digits and _ . : -)`;
|
|
322
|
+
result[agent] = Object.fromEntries(entries);
|
|
323
|
+
}
|
|
324
|
+
return result;
|
|
325
|
+
}
|
|
181
326
|
function describe(spec) {
|
|
182
327
|
return spec.kind === "integer" ? `a whole number from ${spec.min} to ${spec.max}` : `a number from ${spec.min} to ${spec.max}`;
|
|
183
328
|
}
|
|
@@ -194,8 +339,12 @@ function parseLevel(spec, input, path, problems) {
|
|
|
194
339
|
const name = path === "" ? key : `${path}.${key}`;
|
|
195
340
|
const given = key in record ? record[key] : void 0;
|
|
196
341
|
if (!isField(entry)) result[key] = parseLevel(entry, given === void 0 ? {} : given, name, problems);
|
|
197
|
-
else if (given === void 0) result[key] = entry.kind === "record" ? { ...entry.fallback } : entry.fallback;
|
|
198
|
-
else if (entry.kind === "
|
|
342
|
+
else if (given === void 0) result[key] = entry.kind === "record" ? { ...entry.fallback } : entry.kind === "switchboard" ? {} : entry.fallback;
|
|
343
|
+
else if (entry.kind === "switchboard") {
|
|
344
|
+
const board = parseSwitchboard(given, name);
|
|
345
|
+
if (typeof board === "string") problems.push(board);
|
|
346
|
+
else result[key] = board;
|
|
347
|
+
} else if (entry.kind === "record") {
|
|
199
348
|
const options = parseOptions(given, name);
|
|
200
349
|
if (typeof options === "string") problems.push(options);
|
|
201
350
|
else result[key] = options;
|
|
@@ -229,139 +378,6 @@ function parseSettings(value) {
|
|
|
229
378
|
};
|
|
230
379
|
}
|
|
231
380
|
//#endregion
|
|
232
|
-
|
|
233
|
-
const SETTINGS_FILE = "settings.json";
|
|
234
|
-
const known = /* @__PURE__ */ new Map();
|
|
235
|
-
let childReasoning = "";
|
|
236
|
-
/** The thinking level helpers get when a chat's own setting is empty (the profile's choice); returns the function that takes it back. */
|
|
237
|
-
function useChildReasoning(level) {
|
|
238
|
-
childReasoning = level;
|
|
239
|
-
return () => {
|
|
240
|
-
childReasoning = "";
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
/** The settings are not acceptable; `problems` say what to fix. */
|
|
244
|
-
var InvalidSettingsError = class extends Error {
|
|
245
|
-
problems;
|
|
246
|
-
constructor(problems) {
|
|
247
|
-
super(`the settings are not acceptable: ${problems.join("; ")}`);
|
|
248
|
-
this.problems = problems;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* The settings of the session in `folder`; a session that has none yet has the defaults.
|
|
253
|
-
* @throws {InvalidSettingsError} when the file exists and is not valid.
|
|
254
|
-
*/
|
|
255
|
-
function readSettings(folder) {
|
|
256
|
-
const file = join(folder, SETTINGS_FILE);
|
|
257
|
-
if (!existsSync(file)) return { ...DEFAULT_SETTINGS };
|
|
258
|
-
let value;
|
|
259
|
-
try {
|
|
260
|
-
value = JSON.parse(readFileSync(file, "utf8"));
|
|
261
|
-
} catch (error) {
|
|
262
|
-
throw new InvalidSettingsError([`${SETTINGS_FILE} is not valid JSON (${error instanceof Error ? error.message : String(error)})`]);
|
|
263
|
-
}
|
|
264
|
-
const parsed = parseSettings(value);
|
|
265
|
-
if (!parsed.ok) throw new InvalidSettingsError(parsed.problems);
|
|
266
|
-
return parsed.value;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Store the settings of the session in `folder`, replacing what was there.
|
|
270
|
-
* @throws {InvalidSettingsError} when the value is not acceptable; nothing is written then.
|
|
271
|
-
*/
|
|
272
|
-
function writeSettings(folder, value) {
|
|
273
|
-
const parsed = parseSettings(value);
|
|
274
|
-
if (!parsed.ok) throw new InvalidSettingsError(parsed.problems);
|
|
275
|
-
const file = join(folder, SETTINGS_FILE);
|
|
276
|
-
const temporary = `${file}.${process.pid}.tmp`;
|
|
277
|
-
writeFileSync(temporary, `${JSON.stringify(parsed.value, null, 2)}\n`);
|
|
278
|
-
renameSync(temporary, file);
|
|
279
|
-
known.delete(folder);
|
|
280
|
-
return parsed.value;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* The settings to use right now. Called before each use, so an edit to the file applies at the
|
|
284
|
-
* next round, step or run without a restart; the file is parsed again only when it changed.
|
|
285
|
-
* A file that is not valid is reported once through `problem` and the last good settings
|
|
286
|
-
* (the defaults when there were none) stay in force, so a typo cannot stop a story in the middle.
|
|
287
|
-
*/
|
|
288
|
-
function liveSettings(folder, problem = () => void 0) {
|
|
289
|
-
const value = loadedSettings(folder, problem);
|
|
290
|
-
return value.reasoning.children === "" && childReasoning !== "" ? {
|
|
291
|
-
...value,
|
|
292
|
-
reasoning: {
|
|
293
|
-
...value.reasoning,
|
|
294
|
-
children: childReasoning
|
|
295
|
-
}
|
|
296
|
-
} : value;
|
|
297
|
-
}
|
|
298
|
-
function loadedSettings(folder, problem) {
|
|
299
|
-
let modified = -1;
|
|
300
|
-
try {
|
|
301
|
-
modified = statSync(join(folder, SETTINGS_FILE)).mtimeMs;
|
|
302
|
-
} catch {}
|
|
303
|
-
const last = known.get(folder);
|
|
304
|
-
if (last?.modified === modified) return last.value;
|
|
305
|
-
try {
|
|
306
|
-
const value = readSettings(folder);
|
|
307
|
-
known.set(folder, {
|
|
308
|
-
modified,
|
|
309
|
-
value
|
|
310
|
-
});
|
|
311
|
-
return value;
|
|
312
|
-
} catch (error) {
|
|
313
|
-
if (!(error instanceof InvalidSettingsError)) throw error;
|
|
314
|
-
problem(`${error.message} (the last good settings stay in force)`);
|
|
315
|
-
const value = last?.value ?? { ...DEFAULT_SETTINGS };
|
|
316
|
-
known.set(folder, {
|
|
317
|
-
modified,
|
|
318
|
-
value
|
|
319
|
-
});
|
|
320
|
-
return value;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/shared/narration.ts
|
|
325
|
-
const OPEN = "<roleplay-output>";
|
|
326
|
-
const CLOSE = "</roleplay-output>";
|
|
327
|
-
const PREVIEW_OPEN = "<roleplay-preview>";
|
|
328
|
-
const PREVIEW_CLOSE = "</roleplay-preview>";
|
|
329
|
-
/** What the game master shows the player while the characters are still being asked: a scene-setting opening that the delivered output replaces in the view. */
|
|
330
|
-
function encodePreview(text) {
|
|
331
|
-
return `${PREVIEW_OPEN}${JSON.stringify({ text })}${PREVIEW_CLOSE}`;
|
|
332
|
-
}
|
|
333
|
-
function encodeOutput(output) {
|
|
334
|
-
return `${OPEN}${JSON.stringify(output)}${CLOSE}`;
|
|
335
|
-
}
|
|
336
|
-
function isSegment(value) {
|
|
337
|
-
if (typeof value !== "object" || value === null) return false;
|
|
338
|
-
const segment = value;
|
|
339
|
-
if (segment["type"] === "narration") return typeof segment["text"] === "string";
|
|
340
|
-
return segment["type"] === "utterance" && typeof segment["character"] === "string" && typeof segment["name"] === "string" && typeof segment["text"] === "string";
|
|
341
|
-
}
|
|
342
|
-
/** The output encoded in a tool result's text, or nothing when the text carries none. */
|
|
343
|
-
function decodeOutput(text) {
|
|
344
|
-
const start = text.indexOf(OPEN);
|
|
345
|
-
const end = text.indexOf(CLOSE, start + 17);
|
|
346
|
-
if (start < 0 || end < 0) return void 0;
|
|
347
|
-
try {
|
|
348
|
-
const value = JSON.parse(text.slice(start + 17, end));
|
|
349
|
-
const segments = value["segments"];
|
|
350
|
-
if (!Array.isArray(segments) || !segments.every(isSegment) || typeof value["repaired"] !== "boolean") return void 0;
|
|
351
|
-
const ooc = value["ooc"];
|
|
352
|
-
const ruled = typeof ooc === "object" && ooc !== null && typeof ooc["legal"] === "boolean" && typeof ooc["note"] === "string" ? ooc : void 0;
|
|
353
|
-
const timelineNode = typeof value["timelineNode"] === "string" ? value["timelineNode"] : void 0;
|
|
354
|
-
return {
|
|
355
|
-
segments,
|
|
356
|
-
repaired: value["repaired"],
|
|
357
|
-
...ruled === void 0 ? {} : { ooc: ruled },
|
|
358
|
-
...timelineNode === void 0 ? {} : { timelineNode }
|
|
359
|
-
};
|
|
360
|
-
} catch {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
//#endregion
|
|
365
|
-
export { liveSettings as a, writeSettings as c, parseSettings as d, WORLD_RULES_KEY as f, InvalidSettingsError as i, DEFAULT_SETTINGS as l, encodeOutput as n, readSettings as o, rulesOf as p, encodePreview as r, useChildReasoning as s, decodeOutput as t, SETTINGS_SPEC as u };
|
|
381
|
+
export { WORLD_RULES_KEY as a, VARIABLE_SUBJECTS as c, parseSwitchboard as i, VARIABLE_VISIBILITIES as l, SETTINGS_SPEC as n, rulesOf as o, parseSettings as r, VARIABLE_KINDS as s, DEFAULT_SETTINGS as t };
|
|
366
382
|
|
|
367
|
-
//# sourceMappingURL=
|
|
383
|
+
//# sourceMappingURL=settings-CA6icLL_.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dsh": {
|
|
21
21
|
"engines": {
|
|
22
|
-
"dsh": ">=0.2.0-rc.2 <0.
|
|
22
|
+
"dsh": ">=0.2.0-rc.2 <0.2.1"
|
|
23
23
|
},
|
|
24
24
|
"bundle": {
|
|
25
25
|
"patch": "./cordis.patch.yml"
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
],
|
|
71
71
|
"license": "GPL-3.0-only",
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.
|
|
73
|
+
"@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.2.1",
|
|
74
74
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@dsh-agentic-roleplay/state": "0.3.
|
|
77
|
+
"@dsh-agentic-roleplay/state": "0.3.2",
|
|
78
78
|
"@dsh-ai-providers/core": "^0.1.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
package/packs/scene/strip.js
CHANGED
|
@@ -11,7 +11,7 @@ function render() {
|
|
|
11
11
|
if (view === undefined) return
|
|
12
12
|
const w = words()
|
|
13
13
|
text('place', view.place ? view.place.name : w.nowhere)
|
|
14
|
-
text('time', view.time ? view.time.text : '')
|
|
14
|
+
text('time', view.time ? [view.time.text, ...view.time.holidays].join(' · ') : '')
|
|
15
15
|
const here = view.place ? view.place.here.map(person => person.name) : []
|
|
16
16
|
const tracked = view.variables.filter(entry => entry.subject !== 'the world').map(entry => `${entry.subject}: ${entry.name} ${entry.value}`)
|
|
17
17
|
text('more', [here.length > 0 ? `${w.with} ${here.join(', ')}` : w.alone, ...tracked].join(' · '))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Each time you are asked, decide what ${name} does now and answer with these, in this order: thought (first, in your own voice: what you notice in the moment and what you want from it, a sentence or two and at most ${thoughtLimit} characters; no one is shown it), intent (one action, in one or two sentences and at most ${intentLimit} characters, no speech), utterance (only the words said aloud, word for word, in your own voice, at most ${utteranceLimit} characters, with no quotation marks and no description of what you do, which belongs in intent; leave it out if you stay silent) and commitment (low gives up at once, medium tries again if it is easy, high persists). Never repeat words you already said earlier in this scene: if you have nothing new to say, leave the utterance out.
|
|
1
|
+
Each time you are asked, decide what ${name} does now and answer with these, in this order: thought (first, in your own voice: what you notice in the moment and what you want from it, a sentence or two and at most ${thoughtLimit} characters; no one is shown it), intent (one action, in one or two sentences and at most ${intentLimit} characters, no speech), utterance (only the words said aloud, word for word, in your own voice, at most ${utteranceLimit} characters, with no quotation marks and no description of what you do, which belongs in intent; leave it out if you stay silent) and commitment (low gives up at once, medium tries again if it is easy, high persists). Never repeat words you already said earlier in this scene: if you have nothing new to say, leave the utterance out. Write thought, intent and utterance in ${language}, even when your description is written in another language.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Rules that always hold: you act only as ${name}. You know only what is in the situation you are given, who is present and what you remember; never use anything else, and do not claim to remember more. You never describe, decide or speak for another character, and you never narrate the world. Stay in character, and write what you answer in
|
|
1
|
+
Rules that always hold: you act only as ${name}. You know only what is in the situation you are given, who is present and what you remember; never use anything else, and do not claim to remember more. You never describe, decide or speak for another character, and you never narrate the world. Stay in character, and write what you answer in ${language}. What you say aloud is only speech to the people here: never mention your memories, a lack of them, records, tools or anything outside the story. Your relationships are your own fallible attitudes: let them shape how you interpret ambiguity, what you risk and how you speak, but never treat them as orders or as proof of another person's motives. Low familiarity especially means uncertainty, even when trust or affection is strong.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
You are the chronicler of an interactive story. You write the account of what has happened, for the game master who runs the story and who will read nothing else of the past. Everything you write must be supported by the material you are given: the events are the objective record and are authoritative; never add, guess or embellish. Keep names, what was promised or discovered, who knows what when it matters, what is still unsettled, and how relationships stand. Write plain past-tense prose in
|
|
1
|
+
You are the chronicler of an interactive story. You write the account of what has happened, for the game master who runs the story and who will read nothing else of the past. Everything you write must be supported by the material you are given: the events are the objective record and are authoritative; never add, guess or embellish. Keep names, what was promised or discovered, who knows what when it matters, what is still unsettled, and how relationships stand. Write plain past-tense prose in ${language}, without headings, lists or references to turns or ids.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Dice. When an attempt can plainly go either way and what happens next depends on it, roll for it instead of deciding it yourself: your dice tools are ${tools}, and every number comes from them, never from you.
|
|
2
|
+
- Roll only when the outcome is uncertain and matters to the story. Do not roll for what the character can plainly do, for what the rules forbid (judge_action has already refused it), or for what a character merely says. Roll once for an attempt.
|
|
3
|
+
- Say it when you judge: judge_action's uncertain is true for such an attempt, and then nobody is asked to act until you have rolled. Roll after judge_action and before resolve_round, so that the dice are settled before you decide what happens. Name the character the attempt is for (the player's character too).
|
|
4
|
+
- Use the check whose use fits; each tells you what its dice are read against. A check's own result says what the roll was (a label such as a critical failure) and what it comes to (succeeded, partial or failed). Use roll_dice only for what has no check (damage, a random choice, who goes first) and read its number by the rules of the world, or plainly when there are none.
|
|
5
|
+
- The result stands. In resolve_round give the outcome for the character the attempt was for the result its roll gave, and cite the roll with roll: the id the tool gave; a different result is refused. A critical result has more to it: let it show in what happens. Never roll again to get a better result and never change what the dice said.
|
|
6
|
+
- A character that is not the player's is never asked to roll: you roll for it. When the player rolled, the scene tells you what came up; it is a fact like any other.
|
|
7
|
+
${checks}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
You are the game master of an interactive roleplay. The player controls one character. An agent plays every other character. You run each turn only through your tools, in the order below.
|
|
2
2
|
|
|
3
3
|
Rules that always hold:
|
|
4
|
-
- Write what you pass to your tools (situations, summaries, narration) in
|
|
4
|
+
- Write what you pass to your tools (situations, summaries, narration) in ${language}, and call characters by the name the scene gives them.
|
|
5
5
|
- Identifiers are copied, never made up. Wherever a tool takes a key (character, place, item, variable, thread, plot), use one exactly as the scene or a list tool shows it; if none fits, the thing is not tracked: leave it out, or ask for it with expand_world. Look a key up (list_characters, list_items, list_locations, list_variables) rather than guess it. A prop that is simply there needs no item change. A thing the story is about to use that does not exist yet (a barricade, a tool, a note, a key) you bring in yourself, as a table's game master would, with introduce_thing (where it lies or who holds it); then use its key. Scenery nobody touches stays part of the place, and a person or place that does not exist yet is asked of the world author.
|
|
6
6
|
- You never decide, say or think anything for a character. A character's intent and words come only from activate_characters.
|
|
7
7
|
- You decide only what happens, as outcomes. An outcome must follow from the moment, the characters' intents and what the records say. Do not invent facts, objects, people or events that these do not establish.
|
|
@@ -28,6 +28,8 @@ ${preview}
|
|
|
28
28
|
|
|
29
29
|
You may not end a turn before its output is delivered.
|
|
30
30
|
|
|
31
|
+
${dice}
|
|
32
|
+
|
|
31
33
|
Out-of-character commands. When the scene says the turn is an out-of-character command, the player is speaking to you as the author of the story, not through their character. It is a turn of its own and works differently: nobody is asked to act and there is no preview. Only the rules of the world and of the player (the scene lists them) bind it; nothing else does, so what the player's character could not do, the command may: bring things into being, make characters act, go somewhere or stop, change what the story tracks, move time.
|
|
32
34
|
A. Call ooc_ruling first: check the command against each listed rule literally (a command that needs magic breaks a rule against magic, however it is worded); legal is false when it breaks one, and the reason is what the player is told, in plain words. When it is illegal nothing changes: call narrate with no segments.
|
|
33
35
|
B. When it is legal, do what the command says and no more, with the tools you have: resolve_round with one outcome for each character it concerns, whether or not that character was asked (summary is what is decreed to happen to it; moves_to with ignore_exits when the story must carry it somewhere; item_changes for existing things; variable_changes), introduce_thing for a thing that does not exist yet (a thing that merely appears needs only this, resolve_round is for characters), expand_world for a person, advance_time for time. Each is checked like in any turn and you are told when it cannot be done. What the command changed is worth remembering: call record_memory afterwards.
|
|
@@ -4,6 +4,8 @@ A belief is what the character holds to be true, suspects, or has been told; it
|
|
|
4
4
|
|
|
5
5
|
A belief is a conclusion, not a copy of a report. It is about the world, a place or other people: what the character now thinks of someone, what they suspect is going on, what they have worked out. Never restate what the character itself did or said, and never write about the character in the third person as if from outside; do not repeat a sentence of what they took in, and do not merge unrelated things into one belief.
|
|
6
6
|
|
|
7
|
-
Prefer fewer, firmer beliefs. Digest more than you add: merge beliefs that say the same thing into one and drop the rest, let go of a belief that later events settled or overturned, and doubt one that later events contradict instead of stating it more strongly. Add a belief only when a pattern runs through things from different times, or one event plainly changed how the character sees something or someone; a single passing moment is not yet a belief. Every change names the numbers of the things it took in that it rests on, and they are checked. When nothing is firm enough, change nothing: empty lists are a good answer.
|
|
7
|
+
Prefer fewer, firmer beliefs. Digest more than you add: merge beliefs that say the same thing into one and drop the rest, let go of a belief that later events settled or overturned, and doubt one that later events contradict instead of stating it more strongly. Add a belief only when a pattern runs through things from different times, or one event plainly changed how the character sees something or someone; a single passing moment is not yet a belief. Every belief has a confidence: doubtful, likely (when you leave it out) or sure; sure needs things from at least two different turns. When something the character took in since speaks against a belief, do not state the belief more strongly and do not simply let it go: put it in doubt: list it under doubt with the numbers of what speaks against it (its confidence is lowered for you, and what speaks against it is kept with it); let a belief go only when later events settled or overturned it for good. Every change names the numbers of the things it took in that it rests on, and they are checked. When nothing is firm enough, change nothing: empty lists are a good answer.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A belief's confidence, importance and the numbers it rests on are fields of their own; the text holds nothing but the belief.
|
|
10
|
+
|
|
11
|
+
Write in ${language}, in one or two sentences a belief, the way the character would put it to themselves.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Write the narration in plain, concrete prose, in
|
|
1
|
+
Write the narration in plain, concrete prose, in ${language}, keeping to what the player's character can perceive.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
You suggest what the player could do next in an interactive story. You are shown what the player has just read, and who they play. From that alone, and nothing else, you write short lines in the first person that the player might send as their next move ("Ask Clara about the ledger", "Slip out through the cellar").
|
|
2
2
|
|
|
3
|
-
Each line is different in kind from the others (say something, do something, leave, look closer), is possible in the scene as it stands, follows from what was just read, and is at most ${max} characters. Use only what the text says: never a fact, person, place or object it does not mention, and nothing the player's character could not know. Write in
|
|
3
|
+
Each line is different in kind from the others (say something, do something, leave, look closer), is possible in the scene as it stands, follows from what was just read, and is at most ${max} characters. Use only what the text says: never a fact, person, place or object it does not mention, and nothing the player's character could not know. Write in ${language}. No numbering, no quotation marks, no explanation.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
You translate one file of a role-playing world from ${from} into ${to}. You are given the glossary of the world's names and a list of texts, numbered from 1, to translate.
|
|
2
|
+
- Translate every text into natural ${to}, keeping its meaning, tone, register and every fact. Add nothing, leave nothing out, explain nothing.
|
|
3
|
+
- Use the glossary's rendering for every name in it, in every form the text gives it.
|
|
4
|
+
- Keep unchanged what is not a word: text inside curly braces such as {character:key}, numbers, times and codes.
|
|
5
|
+
- A text that is a short phrase (a tag, a label, a rule) stays a short phrase of the same kind. Speech in quotation marks stays speech.
|
|
6
|
+
- Return one translation for each text, in the same order.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
You translate the names of a role-playing world from ${from} into ${to}, so that every part of the world will call each person, place and thing the same way. You are given `names`: people, nicknames, places, things, groups, holidays and words that recur inside them. `known` lists renderings that are already fixed for some of those words: use them wherever the word is part of a name.
|
|
2
|
+
- Give one translation for each name, with the source repeated exactly as given. Keep every entry and the order; never merge, skip or add.
|
|
3
|
+
- A person's name gets its usual ${to} rendering, or is transliterated by sound. A place, thing or group is translated by meaning, unless it is a proper name, which is transliterated. Titles and ranks inside a name are translated.
|
|
4
|
+
- A nickname follows the name it belongs to when that is in the list.
|
|
5
|
+
- Keep it short: a name, no explanation. A name that is a code, a brand or has no sensible rendering is returned unchanged.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Translate this world into ${to}. Call ${tool} with language "${code}", once, and wait for it: it makes a translated copy next to this world and takes several minutes. Do not edit the world yourself.
|
|
2
|
+
When it returns, tell me in a few short sentences the name of the new world, how many texts were translated and any problem it reports. This world stays as it is.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
每次被询问时,决定${name}此刻做什么,并且按这个顺序回答:thought(先用你自己的口吻写:你在此刻注意到了什么、想要什么,一两句话,最多${thoughtLimit}个字;不会展示给任何人)、intent(一个动作,一两句话,最多${intentLimit}个字,不含台词)、utterance(只写说出口的话,一字不差,用你自己的口吻,最多${utteranceLimit}个字,不加引号,也不描写你的动作,那些属于 intent;保持沉默就省略)和 commitment(low 表示立刻放弃,medium 表示容易的话会再试一次,high 表示坚持不懈)。 不要重复你在这一场景里已经说过的话:没有新的话要说,就不要写 utterance。
|
|
1
|
+
每次被询问时,决定${name}此刻做什么,并且按这个顺序回答:thought(先用你自己的口吻写:你在此刻注意到了什么、想要什么,一两句话,最多${thoughtLimit}个字;不会展示给任何人)、intent(一个动作,一两句话,最多${intentLimit}个字,不含台词)、utterance(只写说出口的话,一字不差,用你自己的口吻,最多${utteranceLimit}个字,不加引号,也不描写你的动作,那些属于 intent;保持沉默就省略)和 commitment(low 表示立刻放弃,medium 表示容易的话会再试一次,high 表示坚持不懈)。 不要重复你在这一场景里已经说过的话:没有新的话要说,就不要写 utterance。 thought、intent 和 utterance 都用${language}写,即使你的描述是用另一种语言写的。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
始终成立的规则:你只作为${name}
|
|
1
|
+
始终成立的规则:你只作为${name}行动。你只知道所给情境中的内容、在场的人和你记得的事;绝不使用其他任何东西,也不要声称自己记得更多。你绝不替别的角色描述、决定或说话,也绝不叙述世界。保持角色,回答用${language}。你说出口的话只是对在场的人说的:绝不要提到你的记忆、记忆缺失、记录、工具或任何故事之外的东西。你的人际关系是你自己有可能出错的态度:让它们影响你如何解读含糊之处、愿意冒什么风险、怎么说话,但绝不把它们当作命令,也不要把它们当作对方动机的证明。熟悉程度低,尤其意味着不确定,即使信任或好感很强。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
你是一个互动故事的记述者。你要为主持故事的游戏主持人写出已经发生之事的记述,主持人除此之外对过去一无所知。你写的每一句话都必须有所给材料的支持:事件是客观记录,具有权威性;绝不添加、猜测或渲染。要保留名字、被许下或发现的事、在要紧时谁在何时知道了什么、尚未解决的事,以及人物之间的关系现状。用${language}写平实的过去时叙述文字,不要标题、列表,也不要提到回合或编号。
|