@dsh-agentic-roleplay/core 0.7.3 → 0.8.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/README.md +1 -1
- package/lib/{authoring-tools-CIsWbq0B.js → authoring-tools-DNnx0Nts.js} +1774 -4517
- package/lib/authoring.js +51 -9
- package/lib/{child-CyCViUKa.js → child-D6mpkkCE.js} +130 -6
- package/lib/client.js +661 -427
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -2
- package/lib/doctor.js +2 -2
- package/lib/{gallery-DmBZ2L5l.js → gallery-D9nG3C78.js} +2 -2
- package/lib/{generator-BmdoTIL2.js → generator-r1Czm7oi.js} +2 -2
- package/lib/helper.js +1 -1
- package/lib/{hooks-C8eELrni.js → hooks-BQCzgggH.js} +92 -8
- package/lib/images.js +4 -4
- package/lib/index.js +920 -739
- package/lib/{library-lVNf9qG_.js → library-zI-2tG7h.js} +25 -8
- package/lib/{lorebook-author-tools-BDOs4i5C.js → lorebook-author-tools-ywaYicwd.js} +7 -7
- package/lib/lorebook-authoring.js +4 -4
- package/lib/{narration-DvFBqmqe.js → narration-CnBlVure.js} +52 -8
- package/lib/orchestration.js +95 -18
- package/lib/{pack-jail-DeTscGT2.js → pack-jail-5EJ-WYyW.js} +30 -68
- package/lib/{packs-CY8ms8v_.js → packs-Cv8hanXJ.js} +2 -2
- package/lib/{presenter-agent-cFR4sos3.js → presenter-agent-BSaMSd3G.js} +6 -6
- package/lib/{preset-n4-j6k4S.js → preset-CWI3-0r1.js} +4 -3
- package/lib/{preset-author-tools-2m4BLtws.js → preset-author-tools-BrJYa2cr.js} +7 -7
- package/lib/preset-authoring.js +5 -5
- package/lib/presets-MwOSMMyu.js +3998 -0
- package/lib/{reflection-CJB5s0ip.js → reflection-zSaMsjKj.js} +127 -127
- package/lib/{text-Cwl5s0j0.js → text-BzudpQLS.js} +9 -1
- package/lib/{turn-guard-BvCs1VxB.js → turn-guard-Cv8pfHEA.js} +6 -2
- package/package.json +2 -2
- package/prompts/en/import/casting.md +14 -0
- package/prompts/en/import/classifier.md +9 -0
- package/prompts/en/import/finish-draft.md +1 -0
- package/prompts/en/import/generator.md +8 -0
- package/prompts/en/import/notice-repair.md +4 -0
- package/prompts/en/import/repair-again.md +3 -0
- package/prompts/en/import/roster.md +1 -0
- package/prompts/en/import/variables.md +1 -0
- package/prompts/en/roleplay/game-master.md +3 -0
- package/prompts/en/roleplay/standing.md +1 -0
- package/prompts/en/world/author.md +1 -1
- package/prompts/zh/import/casting.md +14 -0
- package/prompts/zh/import/classifier.md +9 -0
- package/prompts/zh/import/finish-draft.md +1 -0
- package/prompts/zh/import/generator.md +8 -0
- package/prompts/zh/import/notice-repair.md +4 -0
- package/prompts/zh/import/repair-again.md +3 -0
- package/prompts/zh/import/roster.md +1 -0
- package/prompts/zh/import/variables.md +1 -0
- package/prompts/zh/roleplay/game-master.md +3 -0
- package/prompts/zh/roleplay/standing.md +1 -0
- package/prompts/zh/world/author.md +1 -1
- package/lib/route-C6SHz9j2.js +0 -518
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as roleplaySessionOf, t as promptFor } from "./access-DtOxFKBK.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as translator, r as languageOf, t as trimCharacters } from "./text-
|
|
5
|
-
import { a as childTrace, c as runChild, n as childModel, r as childSampling, v as estimateAnswer } from "./child-
|
|
6
|
-
import { s as inheritImages } from "./library-
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
2
|
+
import { F as routeVerdicts, I as yesAt, M as askYesNo, N as mergeReports, P as noAt, f as sha, j as announceProblem, o as listPresets, s as loadPreset } from "./presets-MwOSMMyu.js";
|
|
3
|
+
import { D as describeTime, O as describeWhen, Z as PROMPTS_FOLDER, et as inheritPrompts, j as answerLimits, z as wrongLanguage } from "./hooks-BQCzgggH.js";
|
|
4
|
+
import { i as translator, r as languageOf, t as trimCharacters } from "./text-BzudpQLS.js";
|
|
5
|
+
import { a as childTrace, c as runChild, n as childModel, r as childSampling, v as estimateAnswer } from "./child-D6mpkkCE.js";
|
|
6
|
+
import { s as inheritImages } from "./library-zI-2tG7h.js";
|
|
7
|
+
import { i as inheritPacks } from "./packs-Cv8hanXJ.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";
|
|
@@ -596,6 +596,125 @@ function defaultBoundaries() {
|
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
598
|
//#endregion
|
|
599
|
+
//#region src/host/presets/apply.ts
|
|
600
|
+
/** Which preset a story's prompts came from, and what each copied file held: kept beside the story's database, so that a story can tell its copies from its own edits. */
|
|
601
|
+
const PRESET_RECORD = "preset.json";
|
|
602
|
+
const promptFile = (folder, path) => join(folder, PROMPTS_FOLDER, ...path.split("/"));
|
|
603
|
+
function readRecord(folder) {
|
|
604
|
+
const file = join(folder, PRESET_RECORD);
|
|
605
|
+
if (!existsSync(file)) return void 0;
|
|
606
|
+
let value;
|
|
607
|
+
try {
|
|
608
|
+
value = JSON.parse(readFileSync(file, "utf8"));
|
|
609
|
+
} catch {
|
|
610
|
+
throw new Error(`${file} is damaged`);
|
|
611
|
+
}
|
|
612
|
+
const { name, files } = value ?? {};
|
|
613
|
+
if (typeof name !== "string" || typeof files !== "object" || files === null || !Object.values(files).every((hash) => typeof hash === "string")) throw new Error(`${file} is damaged`);
|
|
614
|
+
return {
|
|
615
|
+
name,
|
|
616
|
+
files
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function writeRecord(folder, record) {
|
|
620
|
+
const file = join(folder, PRESET_RECORD);
|
|
621
|
+
if (record === void 0) {
|
|
622
|
+
rmSync(file, { force: true });
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const temporary = `${file}.tmp`;
|
|
626
|
+
writeFileSync(temporary, JSON.stringify(record, null, 2));
|
|
627
|
+
renameSync(temporary, file);
|
|
628
|
+
}
|
|
629
|
+
/** Writes the preset's prompts over the story's own. */
|
|
630
|
+
function copyPreset(preset, folder) {
|
|
631
|
+
for (const [path, text] of preset.files) {
|
|
632
|
+
const to = promptFile(folder, path);
|
|
633
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
634
|
+
writeFileSync(to, text);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/** Notes that the story's prompts came from the preset: only the files that still hold the preset's text count, because the world's own may have replaced the rest. */
|
|
638
|
+
function recordPreset(folder, preset) {
|
|
639
|
+
const files = {};
|
|
640
|
+
for (const [path, text] of preset.files) {
|
|
641
|
+
const own = promptFile(folder, path);
|
|
642
|
+
if (existsSync(own) && readFileSync(own, "utf8") === text) files[path] = sha(text);
|
|
643
|
+
}
|
|
644
|
+
writeRecord(folder, {
|
|
645
|
+
name: preset.summary.name,
|
|
646
|
+
files
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
/** Where the story stands against the library. */
|
|
650
|
+
function presetStatus(root, folder) {
|
|
651
|
+
const available = listPresets(root).map((entry) => entry.summary);
|
|
652
|
+
const record = readRecord(folder);
|
|
653
|
+
if (record === void 0) return { available };
|
|
654
|
+
const paths = Object.keys(record.files);
|
|
655
|
+
const edited = paths.some((path) => {
|
|
656
|
+
const file = promptFile(folder, path);
|
|
657
|
+
return !existsSync(file) || sha(readFileSync(file, "utf8")) !== record.files[path];
|
|
658
|
+
});
|
|
659
|
+
let state = edited ? "edited" : "current";
|
|
660
|
+
try {
|
|
661
|
+
const library = loadPreset(root, record.name);
|
|
662
|
+
if (!edited && (library.files.size !== paths.length || paths.some((path) => {
|
|
663
|
+
const text = library.files.get(path);
|
|
664
|
+
return text === void 0 || sha(text) !== record.files[path];
|
|
665
|
+
}))) state = "changed";
|
|
666
|
+
} catch {
|
|
667
|
+
state = "missing";
|
|
668
|
+
}
|
|
669
|
+
return {
|
|
670
|
+
applied: {
|
|
671
|
+
name: record.name,
|
|
672
|
+
state,
|
|
673
|
+
files: paths
|
|
674
|
+
},
|
|
675
|
+
available
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Takes the story's copies of its preset out (to `.trash/prompts/` in the story) and, when a preset is named, puts that one in.
|
|
680
|
+
* Prompts the world carried that a preset had replaced are not brought back.
|
|
681
|
+
* @returns the files that were replaced or taken out.
|
|
682
|
+
* @throws {Error} when the named preset has problems or does not exist; nothing is changed then.
|
|
683
|
+
*/
|
|
684
|
+
function switchPreset(root, folder, name, now = Date.now) {
|
|
685
|
+
const next = name === void 0 ? void 0 : loadPreset(root, name);
|
|
686
|
+
if (next !== void 0 && next.summary.problems.length > 0) throw new Error(`the preset "${name}" has problems: ${next.summary.problems.join("; ")}`);
|
|
687
|
+
const record = readRecord(folder);
|
|
688
|
+
const touched = new Set(next === void 0 ? [] : next.files.keys());
|
|
689
|
+
for (const path of Object.keys(record?.files ?? {})) touched.add(path);
|
|
690
|
+
const aside = join(folder, ".trash", PROMPTS_FOLDER, String(now()));
|
|
691
|
+
const moved = [];
|
|
692
|
+
for (const path of touched) {
|
|
693
|
+
const file = promptFile(folder, path);
|
|
694
|
+
if (!existsSync(file)) continue;
|
|
695
|
+
const to = join(aside, ...path.split("/"));
|
|
696
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
697
|
+
copyFileSync(file, to);
|
|
698
|
+
moved.push(path);
|
|
699
|
+
}
|
|
700
|
+
for (const path of Object.keys(record?.files ?? {})) {
|
|
701
|
+
const file = promptFile(folder, path);
|
|
702
|
+
rmSync(file, { force: true });
|
|
703
|
+
}
|
|
704
|
+
if (next === void 0) {
|
|
705
|
+
writeRecord(folder, void 0);
|
|
706
|
+
return moved;
|
|
707
|
+
}
|
|
708
|
+
copyPreset(next, folder);
|
|
709
|
+
recordPreset(folder, next);
|
|
710
|
+
return moved;
|
|
711
|
+
}
|
|
712
|
+
/** A branch plays with the preset of the story it was cut from. */
|
|
713
|
+
function inheritPreset(from, to) {
|
|
714
|
+
const file = join(from, PRESET_RECORD);
|
|
715
|
+
if (existsSync(file)) copyFileSync(file, join(to, PRESET_RECORD));
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
599
718
|
//#region src/shared/timeline.ts
|
|
600
719
|
const emptyTimeline = () => ({
|
|
601
720
|
version: 1,
|
|
@@ -787,125 +906,6 @@ function planMove(timeline, target, surface) {
|
|
|
787
906
|
};
|
|
788
907
|
}
|
|
789
908
|
//#endregion
|
|
790
|
-
//#region src/host/presets/apply.ts
|
|
791
|
-
/** Which preset a story's prompts came from, and what each copied file held: kept beside the story's database, so that a story can tell its copies from its own edits. */
|
|
792
|
-
const PRESET_RECORD = "preset.json";
|
|
793
|
-
const promptFile = (folder, path) => join(folder, PROMPTS_FOLDER, ...path.split("/"));
|
|
794
|
-
function readRecord(folder) {
|
|
795
|
-
const file = join(folder, PRESET_RECORD);
|
|
796
|
-
if (!existsSync(file)) return void 0;
|
|
797
|
-
let value;
|
|
798
|
-
try {
|
|
799
|
-
value = JSON.parse(readFileSync(file, "utf8"));
|
|
800
|
-
} catch {
|
|
801
|
-
throw new Error(`${file} is damaged`);
|
|
802
|
-
}
|
|
803
|
-
const { name, files } = value ?? {};
|
|
804
|
-
if (typeof name !== "string" || typeof files !== "object" || files === null || !Object.values(files).every((hash) => typeof hash === "string")) throw new Error(`${file} is damaged`);
|
|
805
|
-
return {
|
|
806
|
-
name,
|
|
807
|
-
files
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
function writeRecord(folder, record) {
|
|
811
|
-
const file = join(folder, PRESET_RECORD);
|
|
812
|
-
if (record === void 0) {
|
|
813
|
-
rmSync(file, { force: true });
|
|
814
|
-
return;
|
|
815
|
-
}
|
|
816
|
-
const temporary = `${file}.tmp`;
|
|
817
|
-
writeFileSync(temporary, JSON.stringify(record, null, 2));
|
|
818
|
-
renameSync(temporary, file);
|
|
819
|
-
}
|
|
820
|
-
/** Writes the preset's prompts over the story's own. */
|
|
821
|
-
function copyPreset(preset, folder) {
|
|
822
|
-
for (const [path, text] of preset.files) {
|
|
823
|
-
const to = promptFile(folder, path);
|
|
824
|
-
mkdirSync(dirname(to), { recursive: true });
|
|
825
|
-
writeFileSync(to, text);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
/** Notes that the story's prompts came from the preset: only the files that still hold the preset's text count, because the world's own may have replaced the rest. */
|
|
829
|
-
function recordPreset(folder, preset) {
|
|
830
|
-
const files = {};
|
|
831
|
-
for (const [path, text] of preset.files) {
|
|
832
|
-
const own = promptFile(folder, path);
|
|
833
|
-
if (existsSync(own) && readFileSync(own, "utf8") === text) files[path] = sha(text);
|
|
834
|
-
}
|
|
835
|
-
writeRecord(folder, {
|
|
836
|
-
name: preset.summary.name,
|
|
837
|
-
files
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
/** Where the story stands against the library. */
|
|
841
|
-
function presetStatus(root, folder) {
|
|
842
|
-
const available = listPresets(root).map((entry) => entry.summary);
|
|
843
|
-
const record = readRecord(folder);
|
|
844
|
-
if (record === void 0) return { available };
|
|
845
|
-
const paths = Object.keys(record.files);
|
|
846
|
-
const edited = paths.some((path) => {
|
|
847
|
-
const file = promptFile(folder, path);
|
|
848
|
-
return !existsSync(file) || sha(readFileSync(file, "utf8")) !== record.files[path];
|
|
849
|
-
});
|
|
850
|
-
let state = edited ? "edited" : "current";
|
|
851
|
-
try {
|
|
852
|
-
const library = loadPreset(root, record.name);
|
|
853
|
-
if (!edited && (library.files.size !== paths.length || paths.some((path) => {
|
|
854
|
-
const text = library.files.get(path);
|
|
855
|
-
return text === void 0 || sha(text) !== record.files[path];
|
|
856
|
-
}))) state = "changed";
|
|
857
|
-
} catch {
|
|
858
|
-
state = "missing";
|
|
859
|
-
}
|
|
860
|
-
return {
|
|
861
|
-
applied: {
|
|
862
|
-
name: record.name,
|
|
863
|
-
state,
|
|
864
|
-
files: paths
|
|
865
|
-
},
|
|
866
|
-
available
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Takes the story's copies of its preset out (to `.trash/prompts/` in the story) and, when a preset is named, puts that one in.
|
|
871
|
-
* Prompts the world carried that a preset had replaced are not brought back.
|
|
872
|
-
* @returns the files that were replaced or taken out.
|
|
873
|
-
* @throws {Error} when the named preset has problems or does not exist; nothing is changed then.
|
|
874
|
-
*/
|
|
875
|
-
function switchPreset(root, folder, name, now = Date.now) {
|
|
876
|
-
const next = name === void 0 ? void 0 : loadPreset(root, name);
|
|
877
|
-
if (next !== void 0 && next.summary.problems.length > 0) throw new Error(`the preset "${name}" has problems: ${next.summary.problems.join("; ")}`);
|
|
878
|
-
const record = readRecord(folder);
|
|
879
|
-
const touched = new Set(next === void 0 ? [] : next.files.keys());
|
|
880
|
-
for (const path of Object.keys(record?.files ?? {})) touched.add(path);
|
|
881
|
-
const aside = join(folder, ".trash", PROMPTS_FOLDER, String(now()));
|
|
882
|
-
const moved = [];
|
|
883
|
-
for (const path of touched) {
|
|
884
|
-
const file = promptFile(folder, path);
|
|
885
|
-
if (!existsSync(file)) continue;
|
|
886
|
-
const to = join(aside, ...path.split("/"));
|
|
887
|
-
mkdirSync(dirname(to), { recursive: true });
|
|
888
|
-
copyFileSync(file, to);
|
|
889
|
-
moved.push(path);
|
|
890
|
-
}
|
|
891
|
-
for (const path of Object.keys(record?.files ?? {})) {
|
|
892
|
-
const file = promptFile(folder, path);
|
|
893
|
-
rmSync(file, { force: true });
|
|
894
|
-
}
|
|
895
|
-
if (next === void 0) {
|
|
896
|
-
writeRecord(folder, void 0);
|
|
897
|
-
return moved;
|
|
898
|
-
}
|
|
899
|
-
copyPreset(next, folder);
|
|
900
|
-
recordPreset(folder, next);
|
|
901
|
-
return moved;
|
|
902
|
-
}
|
|
903
|
-
/** A branch plays with the preset of the story it was cut from. */
|
|
904
|
-
function inheritPreset(from, to) {
|
|
905
|
-
const file = join(from, PRESET_RECORD);
|
|
906
|
-
if (existsSync(file)) copyFileSync(file, join(to, PRESET_RECORD));
|
|
907
|
-
}
|
|
908
|
-
//#endregion
|
|
909
909
|
//#region src/host/timeline/service.ts
|
|
910
910
|
/** The text of the marker that stands for the turns it replaces: never empty, as a model service may refuse an empty message. */
|
|
911
911
|
const MARKER_TEXT = "(empty message)";
|
|
@@ -2037,6 +2037,6 @@ function memoryReflector(deps) {
|
|
|
2037
2037
|
} };
|
|
2038
2038
|
}
|
|
2039
2039
|
//#endregion
|
|
2040
|
-
export { referent as _, whereabouts as a,
|
|
2040
|
+
export { referent as _, whereabouts as a, readTimeline as c, copyPreset as d, presetStatus as f, sameWords as g, defaultBoundaries as h, reflectionStatus as i, writeTimeline as l, switchPreset as m, memoryReflector as n, TimelineError as o, recordPreset as p, recordFailure as r, Timelines as s, dueReflection as t, pathTo as u };
|
|
2041
2041
|
|
|
2042
|
-
//# sourceMappingURL=reflection-
|
|
2042
|
+
//# sourceMappingURL=reflection-zSaMsjKj.js.map
|
|
@@ -245,6 +245,14 @@ const ZH = {
|
|
|
245
245
|
"(none: write only what the name itself implies, and leave the rest empty)": "(无:只写名字本身能推出的内容,其余留空)",
|
|
246
246
|
"The entities of this world, which are the only ones the entries may name as subjects:": "这个世界里的对象,条目只能以它们作为主题:",
|
|
247
247
|
"Source piece:": "来源片段:",
|
|
248
|
+
"This exact call was already made {count} times in this turn with the same result. Do not repeat it: go on with the next step, or finish and say what is left.": "这个完全相同的调用在本回合内已经执行了 {count} 次,结果相同。不要再重复:继续下一步,或者结束并说明还剩什么。",
|
|
249
|
+
"{label}: how people are made up": "{label}:人物如何生成",
|
|
250
|
+
"{label}: rules and mechanics": "{label}:规则与机制",
|
|
251
|
+
"Already declared (do not declare them again):": "已经声明过的(不要重复声明):",
|
|
252
|
+
"Passages about making people up:": "关于凭空生成人物的段落:",
|
|
253
|
+
"The player used the world's command /{word}: {description}": "玩家使用了这个世界的指令 /{word}:{description}",
|
|
254
|
+
"All the pieces of this card, in order:": "这张卡的所有片段,按顺序:",
|
|
255
|
+
"The standing rules of this world. Apply them on every turn:": "这个世界的常驻规则。每个回合都要遵守:",
|
|
248
256
|
"The instructions of the card:": "卡片的指令:",
|
|
249
257
|
"Characters:": "角色:",
|
|
250
258
|
"Places:": "地点:",
|
|
@@ -294,4 +302,4 @@ function withoutExtension(value) {
|
|
|
294
302
|
//#endregion
|
|
295
303
|
export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
|
|
296
304
|
|
|
297
|
-
//# sourceMappingURL=text-
|
|
305
|
+
//# sourceMappingURL=text-BzudpQLS.js.map
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as guardRepeatedCalls } from "./hooks-BQCzgggH.js";
|
|
2
|
+
import { _ as finishOf, g as cutOff } from "./child-D6mpkkCE.js";
|
|
2
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
3
4
|
//#region src/host/authoring/turn-guard.ts
|
|
4
5
|
/** Times one turn is steered back after a reply was cut off: a model that rambles again after being told not to will not stop because it is told once more. */
|
|
5
6
|
const MAX_NUDGES = 6;
|
|
7
|
+
/** How often one turn may make exactly the same call: an assistant that repeats a call past this is looping (found live: one create-and-list pair 47 times in one review), not working. */
|
|
8
|
+
const MAX_SAME_CALL = 3;
|
|
6
9
|
/**
|
|
7
10
|
* What keeps an authoring assistant (a chat that edits a world, a preset or a lorebook) from running away, besides the limit on what one request may write.
|
|
8
11
|
* - Its thinking level is the one the settings name for these assistants, when its model offers that level: thinking without end filled the whole request and left a turn with nothing done.
|
|
@@ -12,6 +15,7 @@ const MAX_NUDGES = 6;
|
|
|
12
15
|
*/
|
|
13
16
|
function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
14
17
|
const nudged = /* @__PURE__ */ new Map();
|
|
18
|
+
guardRepeatedCalls(ctx, (exec) => exec.agent === void 0 ? void 0 : languageOf(exec.agent.session.id), MAX_SAME_CALL);
|
|
15
19
|
ctx.on("agent/request", async (payload, next) => {
|
|
16
20
|
const config = await next();
|
|
17
21
|
const level = reasoning();
|
|
@@ -50,4 +54,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
50
54
|
//#endregion
|
|
51
55
|
export { guardAuthoringTurns as t };
|
|
52
56
|
|
|
53
|
-
//# sourceMappingURL=turn-guard-
|
|
57
|
+
//# sourceMappingURL=turn-guard-Cv8pfHEA.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@dsh-agentic-roleplay/state": "0.
|
|
79
|
+
"@dsh-agentic-roleplay/state": "0.8.1",
|
|
80
80
|
"@dsh-ai-providers/core": "^0.5.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
You read the passages of a character card that say how people are made up while the story is played. Turn them into the machinery of a story world: the words the player types, and the things that happen when one is used or something occurs.
|
|
2
|
+
|
|
3
|
+
commands: a word the player types after a slash to ask for something ("type /recruit to bring in a follower"). Only the words the card names; never invent one. word: letters, digits or underscores, in the card's language. description: one sentence on what the player is asking for.
|
|
4
|
+
|
|
5
|
+
mechanisms: each time the card says that someone new is to be made, give one entry:
|
|
6
|
+
- name: a short name.
|
|
7
|
+
- command: the word above that starts it, or empty.
|
|
8
|
+
- happens: when the card names no command, one sentence that says what must happen in the story for it to start, written as an event in the past tense ("The player's character brings a new follower into the cult"), never as a state ("there are few followers"). Empty when a command starts it.
|
|
9
|
+
- need: the reason the world author is asked to make someone: what kind of person, in a sentence, as the card says.
|
|
10
|
+
- text: the instruction the world author gets, in your own words from the card's: what the new person must be like. Write [draw] where one drawn option goes, when the card gives a list of kinds or situations to choose from; otherwise leave it out.
|
|
11
|
+
- options: the list of kinds or situations to choose one from, each as the card writes it; empty when the card gives none.
|
|
12
|
+
|
|
13
|
+
Use only what the passages say. A mechanism with neither a command nor a happening is not usable: leave it out.
|
|
14
|
+
${rules}
|
|
@@ -10,7 +10,16 @@ Say which of these it is (one to three, the most important first):
|
|
|
10
10
|
- world: background of the setting: history, events, geography, culture, rules of nature or magic, summaries of what happened.
|
|
11
11
|
- scenario: the situation the story starts in, or its premise.
|
|
12
12
|
- instruction: instructions to the AI or narrator about how to write or run the game: style, formats, status panels, dice or game mechanics, variable or state tracking, option generation, rules for the player's own characters.
|
|
13
|
+
- generator: how people, places or things are made up while the story is played, in the story's own terms: pools of kinds, situations and templates for who turns up where, tables or lists to pick from, the fields a newly made character must have, when to bring someone in. The kinds and examples in it are not entities of the world. Telling the narrator to make up each newcomer's profile when they appear (name, age, looks, personality, background), or to pick from kinds, is generator, even when it is a small part of a long description: add generator whenever any part of the piece says so, in addition to what the piece mostly is. It is not instruction: an instruction says how to write; a generator says who or what to make up.
|
|
13
14
|
- template: a blank form, menu or placeholder with nothing of its own to say.
|
|
14
15
|
- irrelevant: notes to the reader, credits, links, advertising: nothing about the story.
|
|
15
16
|
|
|
16
17
|
A piece that sets a scene in a named or clearly identifiable location (a scenario, an opening) is also place, with that location's name among the names. Also give what the piece is about: first what it is mostly about, then each other named person, place or organisation it mentions (family, associates, rivals, where it happens), each as a name, spelled exactly as the text spells it, and the kind of thing it names (character, place, faction, thing, or other for an event, an idea or anything else); at most ${max}; none if it is about none in particular. A name has one kind: a person is never a place. For player, give the character's name only if the text names one. The text may be in any language: keep the names in it. [PLAYER] stands for the player: never name it.
|
|
18
|
+
|
|
19
|
+
Telling close ones apart:
|
|
20
|
+
- instruction or world: text that speaks to the narrator ("you must", how to write, what to output, how to run a check) is instruction; facts about the setting ("the harbour has a lighthouse", "the guild was founded in the spring") are world, even when a rule is stated as a fact.
|
|
21
|
+
- generator or world: a list of the kinds of people who exist is world; the same list with a procedure for drawing from it when someone new is needed ("pick one for the next stranger", "generate their profile when they appear") is generator, in addition to world.
|
|
22
|
+
- instruction or template: a blank form or menu is template; a form with steps for filling it in, or a format the narrator must follow, is instruction.
|
|
23
|
+
- character or player: the card's own character is character; only the person who uses the card (the player marker, [PLAYER]) is player.
|
|
24
|
+
- scenario or world: where and how the story starts is scenario; how the world works in general is world.
|
|
25
|
+
- A piece with several of these gets up to three roles, the most important first. When a piece holds guidance on making people up inside a long description, add generator.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The world was written, but as a draft: it would not start yet, and the problems are listed above. Repair them now with your editing tools (they run without asking during this turn), reading the original card with card_overview, card_read and card_search to restore what a dangling reference was meant to point at instead of cutting it. Call world_check after each round of fixes: it names the problems of the first part of the world that has any, so fixing one part can show the next, until it reports ok. Change only what is wrong, as little as needed, and never add what the card does not say. Then review the world as a careful editor (places and their ways, starting places, duplicates) and tell the person briefly what was imported, what was repaired and what is left.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
You read one piece of a character card written for a role-playing chat tool. Find two kinds of passage in it and copy each exactly as it is written: the same words, the same order, whole sentences, nothing rewritten, shortened, merged or translated.
|
|
2
|
+
|
|
3
|
+
casting: how people, places or things are made up while the story is played: pools of kinds or situations to choose from, templates, tables, the fields a newly made character must have, when someone new is brought in ("generate each follower's profile when they appear", "pick one of these types for the next stranger", a random encounter table).
|
|
4
|
+
|
|
5
|
+
rules: standing rules and mechanics the game master applies as the story is played: how checks and dice are used, how combat or a contest is run step by step, tables and charts the rules refer to, how the story's state is tracked and changed, what must always or never happen. Not a description of the setting, of a place or of a named character; not how the text is written (style, tone, length, formats of the reply); not a list of tags or markup for a program.
|
|
6
|
+
|
|
7
|
+
A passage belongs to one list only. Give no passages for a kind the piece does not hold. Do not add anything of your own.
|
|
8
|
+
${rules}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
The import of this card was written into the world as a draft, because the world would not start yet. This turn is its repair, started by the person. You may edit the world with your tools (they run without asking during this turn).
|
|
2
|
+
1. Call world_check. It names the problems of the first part of the world that has any: where each is and what is wrong. Fixing them can show the problems of the next part, so call it again after each round of fixes, until it reports ok.
|
|
3
|
+
2. Read the original card (card_overview, card_read, card_search) to restore what a dangling reference was meant to point at, instead of cutting it: a character, place or organisation the card does have is created with create_world_element; a reference to something the card does not have is removed with the editing tools. Change only what is wrong, as little as needed, and never add what the card does not say.
|
|
4
|
+
3. When world_check reports ok, or when you cannot fix what is left, stop and tell the person in a few short sentences what you fixed and what is left, in the person's language. Do not run the import tools again.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The world still would not start after your changes, so the turn cannot end yet. These are the problems world_check reports now:
|
|
2
|
+
${problems}
|
|
3
|
+
Fix them with your editing tools, reading the original card (card_read, card_search) where something it described is missing, then call world_check again. Cut a reference only when the card has nothing it could point at. If you cannot fix what is left, say exactly what is left and why, and stop.
|
|
@@ -4,6 +4,7 @@ For each kind (characters, places, factions, things):
|
|
|
4
4
|
- Merge the names that are the same one into a single entry with its main name, and put the other names it goes by in aliases.
|
|
5
5
|
- Leave out what is not an individual entity: a generic noun, a role without a name that belongs to nobody in particular, a whole country or era that is only a setting, the player ([PLAYER]) and the title of the card itself when it names a work or a setting instead of a being. A card whose own title is the name of the character it is about does list that character.
|
|
6
6
|
- The place where the story starts is a place even when the text only describes it ("her bedroom studio"): list it under a plain name. A place the pieces only mention in passing is left out.
|
|
7
|
+
- A bracketed placeholder that the person using the card is meant to fill in ("[custom start]", "[destination]") is not a place or any other entity: leave it out.
|
|
7
8
|
- A place may be inside another place of the list (a room in a building, a district in a city): give its parent by the parent's main name.
|
|
8
9
|
- An event, incident, case, era or idea is none of these: leave it out (it is background, not an entity).
|
|
9
10
|
- A role without a name (an unnamed merchant, a guard, a crowd) is not a character: leave it out. Ordinary equipment, surroundings and media (a camera, a stream, a window) are not things: only objects that play a part in the story are.
|
|
@@ -3,3 +3,4 @@ A variable is a number (affection, money, health, a day count, a level), a flag
|
|
|
3
3
|
For each: key (lowercase ASCII letters, digits and underscores, starting with a letter, like trust_meter), name, kind (number, flag or choice), subject (character, item, location or world: who or what it is about), visibility (public: everyone can see it, private: only its owner, hidden: only the game master). For a number give min and max when the card gives limits, integer when it counts whole units, and default when the card says where it starts; add bands (up_to and label: "up_to 20 is Hostile") when the card names ranges of values. For a choice give options. Use only when the card limits it to some of the characters, places or things of the list.
|
|
4
4
|
Declare every value a panel or meter shows, one variable each. What the card says about a value belongs in its fields, never in left_out: where it starts is default, its limits are min and max, whole units are integer: true, and named ranges are bands. A value of a person (money, reputation, trust) has subject character; a value of the whole story (the day, the weather) has subject world.
|
|
5
5
|
Leave out, and list in left_out: rules of the game that are not a tracked value, formats of the output, instructions about narration, scripts, and values that belong to one moment of the story and not to the world. When the card tracks nothing, return no variables.
|
|
6
|
+
Declare at most ${max} variables in one answer, the ones the story depends on most first; when the card tracks more, you are asked again for the rest, told which are declared already.
|
|
@@ -9,6 +9,7 @@ Rules that always hold:
|
|
|
9
9
|
- Places are real. The scene tells you where everyone is, what is in each place and the ways out (open, locked or blocked). Characters act on what is in their own place; ask a character elsewhere to act only if the moment truly reaches it (it can see or hear, or is summoned). A character moves only through an open way: say so in the outcome with moves_to, and you are told why when it cannot. Never gather people from elsewhere just to have them react. Do not invent places, exits or people. When the player goes somewhere the world does not list, never move them to an unrelated listed place: use the listed place that contains it (the city, the district). Only when the story has really gone somewhere no known place covers, or someone new really joins, call expand_world once for everything the moment needs (a place and the person in it together, in one request) with the reason and what the story has established; a world author decides. A world author run takes minutes: never ask twice for the same moment, and never for a minor official or attendant who only passes on a message (let a present character do it). Never for colour, atmosphere, a passer-by, a crowd or something mentioned in passing, and never when an existing character or place can serve.
|
|
10
10
|
- Time is real. The scene states the time and how it moves. Say how long each round took (elapsed_seconds in resolve_round) when it is not about a minute; when the player's character sleeps, waits or travels for a stretch you summarise rather than play, use advance_time, then run a round for the characters if what they are doing has changed. Do not narrate the time of day or date against the clock.
|
|
11
11
|
- The scene lists what the story keeps track of (feelings, injuries, debts, flags). When what an outcome establishes changes one, say so in that outcome with variable_changes (to a value, or by an amount); never invent a value the outcome does not establish, and never change something for the sake of it. Something new that must be tracked (and nothing tracked fits) is asked for with expand_world, reason variable.
|
|
12
|
+
- Some worlds keep their own guidance on who turns up and when (pools of kinds of people, tables, templates). Read it with search_lore when a scene could bring someone new (a journey, an arrival, a stop along the way, a gathering) and, at the moments it names, bring them in with expand_world (need arrival or introduction), saying which situation it is and which kind from the guidance fits. Never make a named newcomer up in narration: nobody exists until the world has them.
|
|
12
13
|
- The world acts by itself too. What it did since the last turn, and what it did as a result of a round, is told to you (the scene, the result of resolve_round and advance_time): it already happened, so narrate it as part of what the player can perceive; do not repeat it as an event of your own. A beat is something you are to weave into the story when it fits (it does not decide anything for a character); say you did with its id in addressed in narrate. Cues are given to characters, not to you. Things known beforehand (an exam, a ball) are listed in the scene with who knows of them: they will happen by themselves when their time comes, so you need not stage them early; characters who know of them can refer to them, and those who do not, cannot.
|
|
13
14
|
- The player may try anything, however odd it looks; what merely looks strange, rash or foolish is never a reason to stop it. But an attempt that is not viable or that breaks a rule of the world or of the player (the scene lists them) does not work, and the player's claim of an effect is not a fact: you decide what happens. Never skip the turn and never refuse out of the story: judge it with judge_action first, and play what cannot work as a failed attempt.
|
|
14
15
|
- You do not write the story's records. A separate memory keeper writes them, in the background, from the rounds you ask it to record. Make each outcome clear: what concretely happens to that character, and what others can now see of it.
|
|
@@ -30,6 +31,8 @@ You may not end a turn before its output is delivered.
|
|
|
30
31
|
|
|
31
32
|
${dice}
|
|
32
33
|
|
|
34
|
+
${standing}
|
|
35
|
+
|
|
33
36
|
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.
|
|
34
37
|
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.
|
|
35
38
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(This world has no standing rules of its own.)
|
|
@@ -10,7 +10,7 @@ Something is made up only when ALL of this holds:
|
|
|
10
10
|
If the request does not meet this, decline: say which test it fails and which existing character or place can serve instead. Declining is a good outcome, not a failure.
|
|
11
11
|
|
|
12
12
|
How you work:
|
|
13
|
-
1. Look first. List the characters and places, search what happened, and decide whether something that exists can serve.
|
|
13
|
+
1. Look first. List the characters and places, search what happened, and decide whether something that exists can serve. Before you make up a person, a place or a thing, search the lore for the world's own guidance on making them up (pools of kinds, templates, the fields a profile must have, who turns up in which situation) and follow it: it says what kind of person fits the moment and what their sheet must say, whatever the world's other characters look like. Where it asks for a field our sheets have, fill that field; what no field holds goes in the background.
|
|
14
14
|
2. Decide: make it, or decline.
|
|
15
15
|
3. Make it with edit_world, in one call. Leave out every field you have nothing to say about: never send an empty string. When a call is refused, every reason it lists must be fixed before you call again; sending the same call again fails the same way. A thing starts in exactly one of: lying in a place (at), carried by a character (held_by), worn by one (worn_by), or inside a container (inside); a lock gets the item that opens it (opened_by); say whose it is only when the story did. Use only what the story established (names, roles, facts given); invent the least needed to play a character or describe a place, in keeping with what exists, and never contradict it. A character gets a short summary, a personality that fits, how it speaks, a state, and the place it is in. A place gets a description, features only for things the story established, and a way to the place the story came from (exits, both directions unless the way is one way). A character gets a relationship profile with those it knows, from its side and, where they would know each other, from theirs; no relationship means the other character is unknown. Use knowledge for existing places, things or directed routes it has been established to know without presently seeing them. Use faction memberships and relationships for persistent organisations; a faction is not a scene actor, so use a group character when something must act in a scene. A character who will live its own life off stage (a person with a trade or a household) may also get a day (routines): windows of the day with what it is doing and where, from what its role implies; otherwise leave it out.
|
|
16
16
|
3b. A variable: declare it in the same call as what first changes it (variables, then variable_changes), with a default that is what is true for everything it applies to until something happens.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
你要阅读角色卡中说明“故事进行中如何凭空生成人物”的段落,把它们转成故事世界的机制:玩家输入的词,以及使用它或某件事发生时会发生什么。
|
|
2
|
+
|
|
3
|
+
commands(指令):玩家在斜杠后输入、用来请求某件事的词(“输入 /recruit 引入一个信徒”)。只写卡片里提到的词,不要自己编造。word:字母、数字或下划线,用卡片的语言。description:一句话说明玩家在请求什么。
|
|
4
|
+
|
|
5
|
+
mechanisms(机制):卡片每说到一次要生成新的人物,就给出一项:
|
|
6
|
+
- name:简短的名称。
|
|
7
|
+
- command:启动它的上面那个词,没有就留空。
|
|
8
|
+
- happens:卡片没有指令时,用一句话说明故事里必须发生什么才会启动它,写成已经发生的事件(“玩家的角色把一个新信徒带进了教团”),不要写成状态(“信徒很少”)。由指令启动时留空。
|
|
9
|
+
- need:请世界作者生成人物的原因:什么样的人,一句话,按卡片的说法。
|
|
10
|
+
- text:给世界作者的指示,根据卡片的意思用你自己的话写:新人物必须是什么样。当卡片给出了可供挑选的类型或情境列表时,在应放入抽出选项的位置写 [draw];没有列表就不要写。
|
|
11
|
+
- options:可供挑选的类型或情境列表,每项按卡片的写法;卡片没有给出时留空。
|
|
12
|
+
|
|
13
|
+
只使用段落里写的内容。既没有指令又没有触发事件的机制没有用处:不要写。
|
|
14
|
+
${rules}
|
|
@@ -10,7 +10,16 @@
|
|
|
10
10
|
- world:设定的背景:历史、事件、地理、文化、自然或魔法的规则、已发生之事的概述。
|
|
11
11
|
- scenario:故事开始时所处的情境或前提。
|
|
12
12
|
- instruction:写给 AI 或叙述者的指示,说明如何写作或运行游戏:文风、格式、状态栏、骰子或游戏机制、变量或状态追踪、选项生成、针对玩家自己角色的规则。
|
|
13
|
+
- generator:在故事进行中如何凭空生成人物、地点或物品,用故事自己的口径写成:谁会在什么情境下出现的类型池和模板、可供挑选的表格或列表、新生成的角色必须具备的字段、何时引入某人。其中的类型和示例不是这个世界的实体。如果叙述者被要求在新人物出场时现编其档案(姓名、年龄、外貌、性格、背景),或从若干类型里挑选,那就是 generator,哪怕它只占一段长描述里的一小部分:只要这一段有任何部分这样说,除了它主要属于的类别之外,还要加上 generator。它不是 instruction:instruction 说的是怎么写,generator 说的是要编造谁或什么。
|
|
13
14
|
- template:空白的表格、菜单或占位内容,本身没有任何实质信息。
|
|
14
15
|
- irrelevant:写给读者的说明、署名、链接、广告:与故事无关的内容。
|
|
15
16
|
|
|
16
17
|
如果这一段把场景设在一个有名字或可明确辨认的地点(情境、开场白),它同时也是 place,并把该地点的名字放进名字列表。此外,还要给出这一段讲到的对象:先是主要讲到的,再是它提到的其他有名字的人、地点或组织(亲属、同伴、对手、事情发生的地方):每个对象用名字(与原文的写法完全一致)和它所指事物的类别来表示(character、place、faction、thing,或 other 表示事件、概念及其他任何东西);最多 ${max} 个;如果没有特别讲到谁,就不给。一个名字只有一种类别:人物绝不是地点。对于 player,只有当文字写出了该角色的名字时才给出名字。文字可能是任何语言:名字保持原文写法。[PLAYER] 代表玩家:绝不要把它当作名字。
|
|
18
|
+
|
|
19
|
+
如何区分相近的类别:
|
|
20
|
+
- instruction 还是 world:对叙述者说的话(“你必须”、怎么写、输出什么、怎样进行检定)是 instruction;关于设定的事实(“港口有一座灯塔”“公会成立于春天”)是 world,即使规则是以陈述事实的口吻写出的。
|
|
21
|
+
- generator 还是 world:列出存在哪几类人物的清单是 world;同一份清单再加上需要新人物时如何从中抽取的步骤(“为下一个陌生人挑一种”“他们出场时生成其档案”)则除了 world 之外还是 generator。
|
|
22
|
+
- instruction 还是 template:空白的表格或菜单是 template;带有填写步骤的表格,或叙述者必须遵循的格式,是 instruction。
|
|
23
|
+
- character 还是 player:卡片自己的角色是 character;只有使用这张卡的人(即玩家标记 [PLAYER])才是 player。
|
|
24
|
+
- scenario 还是 world:故事在哪里、怎样开始是 scenario;世界总体如何运作是 world。
|
|
25
|
+
- 一段内容涉及多个类别时,最多给三个,最重要的排在前面。如果长篇描述中含有关于凭空生成人物的指引,要加上 generator。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
世界已经写入,但是作为草稿写入的:它目前还无法开始,上面列出了问题。现在用编辑工具修复它们(本回合内这些工具无需询问即可执行),并用 card_overview、card_read 和 card_search 阅读原始角色卡,恢复悬空引用原本要指向的东西,而不是直接把引用砍掉。每修完一轮就调用 world_check:它会指出世界中第一个有问题的部分,所以修好一处可能露出下一处,直到它报告 ok。只改有问题的地方,改动越小越好,绝不要添加卡里没写的内容。然后像一名细心的编辑那样检查这个世界(地点及其通路、起始地点、重复项),并简要告诉用户导入了什么、修复了什么、还剩什么。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
你要阅读一张为角色扮演聊天工具写的角色卡中的一段内容。找出其中两类段落,并把每一段原样抄出:用词相同、顺序相同、整句抄录,不要改写、缩短、合并或翻译。
|
|
2
|
+
|
|
3
|
+
casting(凭空生成):在故事进行中如何凭空生成人物、地点或物品:可供挑选的类型或情境池、模板、表格、新生成的角色必须具备的字段、何时引入新人物(例如“每个信徒出场时生成其档案”“下一个陌生人从这几种类型里挑一种”、随机遭遇表)。
|
|
4
|
+
|
|
5
|
+
rules(规则与机制):游戏主持人在故事进行中要持续遵守的规则与机制:检定和骰子怎么用、战斗或对抗按什么步骤进行、规则所引用的表格和图表、故事状态怎样记录和改变、什么必须始终发生或绝不能发生。不包括对背景设定、某个地点或某个有名字的角色的描述;不包括文字怎么写(文风、语气、长度、回复格式);也不包括给程序用的标签或标记列表。
|
|
6
|
+
|
|
7
|
+
一段内容只属于其中一类。这一段里没有的那一类就不要给出任何段落。不要添加任何你自己的内容。
|
|
8
|
+
${rules}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
这张卡的导入结果已作为草稿写进世界,因为这个世界目前还无法开始。这一回合是对它的修复,由用户发起。你可以用工具编辑这个世界(本回合内这些工具无需询问即可执行)。
|
|
2
|
+
1. 先调用 world_check。它会指出世界中第一个有问题的部分:每个问题在哪里、错在哪里。修好之后可能会露出下一个部分的问题,所以每修完一轮就再调用一次,直到它报告 ok。
|
|
3
|
+
2. 阅读原始角色卡(card_overview、card_read、card_search),用来恢复悬空引用原本要指向的东西,而不是直接把引用砍掉:卡里确实有的角色、地点或组织,用 create_world_element 创建;卡里没有的东西,用编辑工具把引用移除。只改有问题的地方,改动越小越好,绝不要添加卡里没写的内容。
|
|
4
|
+
3. 当 world_check 报告 ok,或者剩下的问题你无法修复时,就停下,用几句话向用户说明你修了什么、还剩什么,使用用户的语言。不要再运行导入工具。
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
- 把指同一个对象的名字合并成一条,用它的主要名字,其余的叫法放进 aliases。
|
|
5
5
|
- 去掉不是个体实体的内容:泛称名词、不属于任何特定对象的无名身份、只是背景的整个国家或时代、玩家([PLAYER]),以及卡片本身的标题(当标题是一部作品或一个设定的名字而不是某个存在时)。如果卡片标题就是卡片所写角色的名字,则要把该角色列入。
|
|
6
6
|
- 故事开始的地点即使文字只是描述(例如“她的卧室工作室”)也算一个地点:用一个平实的名字列出。只是顺带提到的地点不要列入。
|
|
7
|
+
- 使用这张卡的人需要自己填写的方括号占位符(例如“[自定义起始地]”“[目的地]”)不是地点,也不是任何其他实体:不要列入。
|
|
7
8
|
- 一个地点可以位于清单中的另一个地点之内(建筑里的房间、城市里的街区):用上级地点的主要名字给出 parent。
|
|
8
9
|
- 事件、案件、时代或概念都不属于这些类别:不要列入(它们是背景,不是实体)。
|
|
9
10
|
- 没有名字的身份(无名的商人、卫兵、人群)不是角色:不要列入。普通的器材、环境和载体(摄像机、直播、窗户)不是物品:只有在故事中起作用的物品才算。
|
|
@@ -3,3 +3,4 @@
|
|
|
3
3
|
每个变量写:key(小写 ASCII 字母、数字和下划线,以字母开头,例如 trust_meter)、name、kind(number、flag 或 choice)、subject(character、item、location 或 world:它是关于谁或什么的)、visibility(public:所有人可见,private:只有拥有者可见,hidden:只有主持人可见)。数字在卡片给出范围时写 min 和 max,按整数计数时写 integer,卡片说明起点时写 default;卡片给出数值区间的名称时写 bands(up_to 和 label,例如“20 以下是敌对”)。选项写 options。只有当卡片把它限定给列表中的部分角色、地点或物品时才写 only。
|
|
4
4
|
面板或指标显示的每个数值都要声明,一个数值一个变量。卡片对数值说过的话要写进它的字段,不要列入 left_out:起点是 default,范围是 min 和 max,整数计数写 integer: true,有名字的区间写 bands。属于玩家的数值(金钱、声望)subject 为 character;整个故事共有的数值(日期、天气)subject 为 world。
|
|
5
5
|
不要保留,并列入 left_out:不属于被追踪数值的游戏规则、输出格式、关于叙述的指令、脚本,以及只属于故事某一刻而不属于世界的数值。卡片没有追踪任何东西时,不返回变量。
|
|
6
|
+
一次回答最多声明 ${max} 个变量,先写故事最依赖的那些;卡片追踪的更多时,会再次询问其余的,并告诉你已经声明了哪些。
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- 地点是真实的。场景会告诉你每个人在哪里、每个地点里有什么,以及出路(开着的、锁着的或被堵住的)。角色只对自己所在地点的东西采取行动;只有当这一刻确实能触及到在别处的角色时(它能看到或听到,或被召唤),才让它行动。角色只能通过开着的路移动:在结果里用 moves_to 写明,如果做不到,你会被告知原因。不要为了让别处的人有反应就把他们聚到一起。不要编造地点、出口或人物。当玩家去往世界里没有列出的地方时,绝不要把他移到一个毫不相干的已列出地点:用包含它的已列出地点(城市、街区)。只有故事真的走到了任何已知地点都不涵盖的地方,或真的有新的人加入时,才调用 expand_world,写明原因和故事已经确立的内容,由世界作者来决定。需要时只调用一次 expand_world,把这一刻所需的一切(地点和其中的人)合并成一个请求;世界作者一次运行要好几分钟:同一时刻绝不要请求两次,也不要为只是传话的小官员或随从请求(让在场的角色去做)。绝不要为了增添色彩、营造气氛、一个路人、一群人或一个顺带提到的东西而这样做,当现有的角色或地点可以胜任时也绝不要这样做。
|
|
10
10
|
- 时间是真实的。场景会说明时间以及它如何流逝。当一轮耗时并不是大约一分钟时,要说明它花了多久(resolve_round 中的 elapsed_seconds);当玩家的角色睡觉、等待或赶路一段时间、而你选择概括而不是逐轮演绎时,使用 advance_time,然后,如果角色们正在做的事发生了变化,就为他们再运行一轮。不要对着时钟去叙述一天中的时间或日期。
|
|
11
11
|
- 场景会列出故事所追踪的东西(情绪、伤势、债务、标志)。当某个结果所确立的内容改变了其中之一时,在该结果里用 variable_changes 说明(改为某个值,或增减某个数量);绝不虚构结果没有确立的值,也绝不为改而改。需要追踪、而又没有任何已追踪项合适的新东西,用 expand_world 提出,原因为 variable。
|
|
12
|
+
- 有些世界自带关于“谁会在何时出现”的指引(人物类型池、表格、模板)。当一个场景可能带来新人(旅途、到达、途中停靠、聚会)时,用 search_lore 读一读;在指引点到的时刻,用 expand_world(need 为 arrival 或 introduction)把人引入,并说明是什么情境、指引里的哪一类合适。绝不要在叙述里凭空安排一个有名字的新来者:世界还没有这个人,他就不存在。
|
|
12
13
|
- 世界也会自己行动。自上一回合以来它做了什么,以及作为某一轮的结果它做了什么,都会告诉你(场景、resolve_round 和 advance_time 的结果):它已经发生了,所以把它当作玩家能感知到的内容的一部分来叙述;不要把它当作你自己的事件重复一遍。beat 是在合适时要织进故事的东西(它不替任何角色做决定);在 narrate 的 addressed 里写上它的 id,说明你已经做了。cue 是给角色的,不是给你的。事先已知的事(考试、舞会)会列在场景里,并写明谁知道它们:时间到了它们会自己发生,所以你不必提前去安排;知道的角色可以提到它们,不知道的角色则不能。
|
|
13
14
|
- 玩家可以尝试任何事,不管看上去多么古怪;仅仅看上去奇怪、鲁莽或愚蠢,从来不是阻止它的理由。但是,不可行的尝试,或违反世界规则或玩家自己规则(场景会列出)的尝试,不会成功,而玩家声称的效果也不是事实:由你决定发生什么。绝不跳过回合,也绝不跳出故事去拒绝:先用 judge_action 判断它,并把不可能成功的事当作一次失败的尝试来演绎。
|
|
14
15
|
- 你不写故事的记录。另有一位记忆记录员在后台,根据你要求它记录的各轮来写。让每个结果都清楚:这个角色身上具体发生了什么,以及别人现在能看到它的什么。
|
|
@@ -30,6 +31,8 @@ ${preview}
|
|
|
30
31
|
|
|
31
32
|
${dice}
|
|
32
33
|
|
|
34
|
+
${standing}
|
|
35
|
+
|
|
33
36
|
戏外指令。当场景说明这一回合是一条戏外指令时,是玩家在以故事作者的身份对你说话,而不是通过他们的角色。它自成一回合,运作方式不同:没有人被要求行动,也没有预览。只有世界的规则和玩家自己的规则(场景会列出)约束它;其他任何东西都不约束它,所以玩家的角色做不到的事,这条指令可以做到:让东西出现、让角色行动、去某个地方或停下、改变故事所追踪的东西、推进时间。
|
|
34
37
|
A. 先调用 ooc_ruling:逐字对照每一条所列规则检查这条指令(需要魔法的指令违反了禁止魔法的规则,无论怎么措辞);当它违反其中一条时,legal 为 false,并且用平实的话写出理由,玩家会看到这个理由。当它不合法时,什么也不会改变:调用 narrate,不带任何片段。
|
|
35
38
|
B. 当它合法时,按指令说的去做,不多做,用你有的工具:用 resolve_round 为它涉及的每个角色给一个结果,不论该角色之前有没有被询问(summary 是被判定发生在它身上的事;当故事必须把它带到某处时,用 moves_to 加 ignore_exits;用 item_changes 处理已有的物品;用 variable_changes);用 introduce_thing 处理尚不存在的物品(单纯冒出来的物品只需要它,resolve_round 是给角色用的),用 expand_world 处理尚不存在的人;用 advance_time 处理时间。每一项都像在任何一回合中一样被检查,做不到时会告诉你。指令改变的内容值得记住:之后调用 record_memory。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(这个世界没有自己的常驻规则。)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
如果请求不符合这些条件,就拒绝:说明它没通过哪一条,以及哪个现有角色或地点可以代替。拒绝是好的结果,不是失败。
|
|
11
11
|
|
|
12
12
|
你的工作方式:
|
|
13
|
-
1.
|
|
13
|
+
1. 先看。列出角色和地点,搜索发生过的事,判断是否有现有的东西可以胜任。在凭空造出人物、地点或物品之前,先在背景资料里搜索这个世界自己关于如何生成它们的指引(类型池、模板、档案必须包含的字段、什么情境下会出现什么人),并照它做:它说明什么样的人适合当下的时刻、他们的档案必须写什么,不必管世界里其他角色是什么样子。指引要求的字段如果角色表里有,就填进那个字段;没有对应字段的内容写进背景。
|
|
14
14
|
2. 决定:造,或者拒绝。
|
|
15
15
|
3. 用 edit_world 一次调用造出它。凡是你没有话可说的字段都省略:绝不发送空字符串。调用被拒绝时,它列出的每一条理由都必须修正之后才能再次调用;原样再发一次只会以同样的方式失败。一件物品恰好以下面之一的方式开始:放在某个地点(at)、由某个角色携带(held_by)、由某个角色穿戴(worn_by)、或在某个容器里(inside);锁要给出能打开它的物品(opened_by);只有当故事说明了它归谁时,才写归属。只使用故事已确立的内容(名字、身份、给出的事实);为了能扮演一个角色或描述一个地点,只虚构最必要的部分,与已有内容保持一致,绝不与之矛盾。一个角色要有简短的 summary、合适的性格、说话方式、状态,以及所在的地点。一个地点要有描述、只包含故事已确立之物的 features,以及通向故事来源地点的路径(exits,除非是单向的,否则双向都要有)。一个角色要有与它认识的人的关系档案,从它这一边写,并且在对方也会认识它的情况下,也从对方那一边写;没有关系,就意味着对方是它不认识的人。对于已经确立它知道、但此刻看不到的现有地点、物品或有方向的路径,使用 knowledge。对于长期存在的组织,使用组织成员关系和关系;组织不是场景中的行动者,所以当需要在场景里行动时,使用群体角色(group character)。一个会在台下过自己生活的角色(有职业或有家庭的人),也可以给它一天的安排(routines):一天中的时间窗口,写明它在做什么、在哪里,依据它的身份合理推出;否则就省略。
|
|
16
16
|
3b. 变量:在第一次改变它的那次调用里一并声明它(先 variables,再 variable_changes),默认值是在发生任何事之前,对它适用的所有对象都成立的值。
|