@dsh-agentic-roleplay/core 0.7.3 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{access-DtOxFKBK.js → access-CfQWbNZP.js} +4 -7
- package/lib/authoring-tools-BgmC2oqU.js +3691 -0
- package/lib/authoring.js +59 -24
- package/lib/{child-CyCViUKa.js → child-lYYeOwl2.js} +147 -46
- package/lib/client.js +931 -860
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +8 -13
- package/lib/{doctor-chat-ByDfCMeo.js → doctor-chat-hL1a61hp.js} +2 -3
- package/lib/doctor.js +6 -8
- package/lib/{gallery-DmBZ2L5l.js → gallery-D1V4h8vh.js} +3 -4
- package/lib/{generator-BmdoTIL2.js → generator-CLPosooC.js} +3 -4
- package/lib/helper.js +2 -3
- package/lib/{hooks-C8eELrni.js → hooks-rQTTeOC4.js} +144 -88
- package/lib/images.js +4 -4
- package/lib/index.js +1024 -913
- package/lib/{library-lVNf9qG_.js → library-Dfu0dgRj.js} +32 -21
- package/lib/{lorebook-author-tools-BDOs4i5C.js → lorebook-author-tools-BAaAqZZm.js} +11 -14
- package/lib/lorebook-authoring.js +5 -6
- package/lib/{narration-DvFBqmqe.js → narration-CjB_KwwY.js} +58 -20
- package/lib/orchestration.js +138 -72
- package/lib/{pack-jail-DeTscGT2.js → pack-jail-CN-314ln.js} +94 -137
- package/lib/{packs-CY8ms8v_.js → packs-DIj5BEfq.js} +6 -10
- package/lib/{presenter-agent-cFR4sos3.js → presenter-agent-DR0KvLE0.js} +13 -19
- package/lib/{preset-n4-j6k4S.js → preset-CscHj1-Y.js} +5 -5
- package/lib/{preset-author-tools-2m4BLtws.js → preset-author-tools-CxluF8qc.js} +13 -15
- package/lib/preset-authoring.js +6 -7
- package/lib/presets-HB8kJTaE.js +3993 -0
- package/lib/{reflection-CJB5s0ip.js → reflection-Dg1xtOTW.js} +137 -148
- package/lib/{text-Cwl5s0j0.js → text-DyRN4nDP.js} +13 -7
- package/lib/{turn-guard-BvCs1VxB.js → turn-guard-g_hDn0jR.js} +6 -7
- package/package.json +29 -29
- package/prompts/en/import/casting.md +14 -0
- package/prompts/en/import/character.md +1 -0
- package/prompts/en/import/classifier.md +9 -0
- package/prompts/en/import/finish-draft.md +1 -0
- package/prompts/en/import/generator.md +8 -0
- package/prompts/en/import/notice-repair.md +4 -0
- package/prompts/en/import/repair-again.md +3 -0
- package/prompts/en/import/roster.md +1 -0
- package/prompts/en/import/variables.md +1 -0
- package/prompts/en/roleplay/game-master.md +3 -0
- package/prompts/en/roleplay/standing.md +1 -0
- package/prompts/en/world/author.md +1 -1
- package/prompts/zh/import/casting.md +14 -0
- package/prompts/zh/import/character.md +1 -0
- package/prompts/zh/import/classifier.md +9 -0
- package/prompts/zh/import/finish-draft.md +1 -0
- package/prompts/zh/import/generator.md +8 -0
- package/prompts/zh/import/notice-repair.md +4 -0
- package/prompts/zh/import/repair-again.md +3 -0
- package/prompts/zh/import/roster.md +1 -0
- package/prompts/zh/import/variables.md +1 -0
- package/prompts/zh/roleplay/game-master.md +3 -0
- package/prompts/zh/roleplay/standing.md +1 -0
- package/prompts/zh/world/author.md +1 -1
- package/lib/authoring-tools-CIsWbq0B.js +0 -6317
- package/lib/route-C6SHz9j2.js +0 -518
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { o as roleplaySessionOf, t as promptFor } from "./access-
|
|
2
|
-
import {
|
|
3
|
-
import { A as answerLimits, D as describeWhen, E as describeTime,
|
|
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-
|
|
1
|
+
import { o as roleplaySessionOf, t as promptFor } from "./access-CfQWbNZP.js";
|
|
2
|
+
import { B as noAt, H as yesAt, I as announceProblem, L as askYesNo, R as mergeReports, V as routeVerdicts, f as sha, o as listPresets, s as loadPreset } from "./presets-HB8kJTaE.js";
|
|
3
|
+
import { A as answerLimits, D as describeWhen, E as describeTime, R as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts } from "./hooks-rQTTeOC4.js";
|
|
4
|
+
import { i as translator, r as languageOf, t as trimCharacters } from "./text-DyRN4nDP.js";
|
|
5
|
+
import { a as childTrace, c as runChild, n as childModel, r as childSampling, v as estimateAnswer } from "./child-lYYeOwl2.js";
|
|
6
|
+
import { s as inheritImages } from "./library-Dfu0dgRj.js";
|
|
7
|
+
import { i as inheritPacks } from "./packs-DIj5BEfq.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";
|
|
11
11
|
import { MINUTE, characterKey, describeDuration, locationKey, mentioned, overlap, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
12
|
-
|
|
12
|
+
// ../dsh-roleplay-model/src/memory.ts
|
|
13
13
|
const MEMORY_KINDS = [
|
|
14
14
|
"belief",
|
|
15
15
|
"relationship",
|
|
@@ -21,8 +21,7 @@ const MEMORY_CONFIDENCES = [
|
|
|
21
21
|
"likely",
|
|
22
22
|
"sure"
|
|
23
23
|
];
|
|
24
|
-
|
|
25
|
-
//#region src/host/orchestration/referent.ts
|
|
24
|
+
// src/host/orchestration/referent.ts
|
|
26
25
|
/**
|
|
27
26
|
* How a person is named wherever the text may go on to say what they do: the name with the pronouns the world gave them, or the gender when only that is given.
|
|
28
27
|
* A model that is not told guesses, and a wrong guess written into a record or a narration is never corrected; nothing is made up when the world says neither.
|
|
@@ -31,8 +30,7 @@ function referent(character) {
|
|
|
31
30
|
const mark = [character.pronouns, character.gender].find((text) => text !== void 0 && text.trim() !== "")?.trim();
|
|
32
31
|
return mark === void 0 ? character.name : `${character.name} (${mark})`;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
//#region src/host/orchestration/defaults.ts
|
|
33
|
+
// src/host/orchestration/defaults.ts
|
|
36
34
|
const ENGLISH = translator("en");
|
|
37
35
|
/** What the instructions say about how long each part of a character's answer may run. */
|
|
38
36
|
const limitVariables = (language) => {
|
|
@@ -595,8 +593,125 @@ function defaultBoundaries() {
|
|
|
595
593
|
sceneContext: castSummary
|
|
596
594
|
};
|
|
597
595
|
}
|
|
598
|
-
|
|
599
|
-
|
|
596
|
+
// src/host/presets/apply.ts
|
|
597
|
+
/** 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. */
|
|
598
|
+
const PRESET_RECORD = "preset.json";
|
|
599
|
+
const promptFile = (folder, path) => join(folder, PROMPTS_FOLDER, ...path.split("/"));
|
|
600
|
+
function readRecord(folder) {
|
|
601
|
+
const file = join(folder, PRESET_RECORD);
|
|
602
|
+
if (!existsSync(file)) return void 0;
|
|
603
|
+
let value;
|
|
604
|
+
try {
|
|
605
|
+
value = JSON.parse(readFileSync(file, "utf8"));
|
|
606
|
+
} catch {
|
|
607
|
+
throw new Error(`${file} is damaged`);
|
|
608
|
+
}
|
|
609
|
+
const { name, files } = value ?? {};
|
|
610
|
+
if (typeof name !== "string" || typeof files !== "object" || files === null || !Object.values(files).every((hash) => typeof hash === "string")) throw new Error(`${file} is damaged`);
|
|
611
|
+
return {
|
|
612
|
+
name,
|
|
613
|
+
files
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
function writeRecord(folder, record) {
|
|
617
|
+
const file = join(folder, PRESET_RECORD);
|
|
618
|
+
if (record === void 0) {
|
|
619
|
+
rmSync(file, { force: true });
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const temporary = `${file}.tmp`;
|
|
623
|
+
writeFileSync(temporary, JSON.stringify(record, null, 2));
|
|
624
|
+
renameSync(temporary, file);
|
|
625
|
+
}
|
|
626
|
+
/** Writes the preset's prompts over the story's own. */
|
|
627
|
+
function copyPreset(preset, folder) {
|
|
628
|
+
for (const [path, text] of preset.files) {
|
|
629
|
+
const to = promptFile(folder, path);
|
|
630
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
631
|
+
writeFileSync(to, text);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
/** 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. */
|
|
635
|
+
function recordPreset(folder, preset) {
|
|
636
|
+
const files = {};
|
|
637
|
+
for (const [path, text] of preset.files) {
|
|
638
|
+
const own = promptFile(folder, path);
|
|
639
|
+
if (existsSync(own) && readFileSync(own, "utf8") === text) files[path] = sha(text);
|
|
640
|
+
}
|
|
641
|
+
writeRecord(folder, {
|
|
642
|
+
name: preset.summary.name,
|
|
643
|
+
files
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
/** Where the story stands against the library. */
|
|
647
|
+
function presetStatus(root, folder) {
|
|
648
|
+
const available = listPresets(root).map((entry) => entry.summary);
|
|
649
|
+
const record = readRecord(folder);
|
|
650
|
+
if (record === void 0) return { available };
|
|
651
|
+
const paths = Object.keys(record.files);
|
|
652
|
+
const edited = paths.some((path) => {
|
|
653
|
+
const file = promptFile(folder, path);
|
|
654
|
+
return !existsSync(file) || sha(readFileSync(file, "utf8")) !== record.files[path];
|
|
655
|
+
});
|
|
656
|
+
let state = edited ? "edited" : "current";
|
|
657
|
+
try {
|
|
658
|
+
const library = loadPreset(root, record.name);
|
|
659
|
+
if (!edited && (library.files.size !== paths.length || paths.some((path) => {
|
|
660
|
+
const text = library.files.get(path);
|
|
661
|
+
return text === void 0 || sha(text) !== record.files[path];
|
|
662
|
+
}))) state = "changed";
|
|
663
|
+
} catch {
|
|
664
|
+
state = "missing";
|
|
665
|
+
}
|
|
666
|
+
return {
|
|
667
|
+
applied: {
|
|
668
|
+
name: record.name,
|
|
669
|
+
state,
|
|
670
|
+
files: paths
|
|
671
|
+
},
|
|
672
|
+
available
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* 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.
|
|
677
|
+
* Prompts the world carried that a preset had replaced are not brought back.
|
|
678
|
+
* @returns the files that were replaced or taken out.
|
|
679
|
+
* @throws {Error} when the named preset has problems or does not exist; nothing is changed then.
|
|
680
|
+
*/
|
|
681
|
+
function switchPreset(root, folder, name, now = Date.now) {
|
|
682
|
+
const next = name === void 0 ? void 0 : loadPreset(root, name);
|
|
683
|
+
if (next !== void 0 && next.summary.problems.length > 0) throw new Error(`the preset "${name}" has problems: ${next.summary.problems.join("; ")}`);
|
|
684
|
+
const record = readRecord(folder);
|
|
685
|
+
const touched = new Set(next === void 0 ? [] : next.files.keys());
|
|
686
|
+
for (const path of Object.keys(record?.files ?? {})) touched.add(path);
|
|
687
|
+
const aside = join(folder, ".trash", PROMPTS_FOLDER, String(now()));
|
|
688
|
+
const moved = [];
|
|
689
|
+
for (const path of touched) {
|
|
690
|
+
const file = promptFile(folder, path);
|
|
691
|
+
if (!existsSync(file)) continue;
|
|
692
|
+
const to = join(aside, ...path.split("/"));
|
|
693
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
694
|
+
copyFileSync(file, to);
|
|
695
|
+
moved.push(path);
|
|
696
|
+
}
|
|
697
|
+
for (const path of Object.keys(record?.files ?? {})) {
|
|
698
|
+
const file = promptFile(folder, path);
|
|
699
|
+
rmSync(file, { force: true });
|
|
700
|
+
}
|
|
701
|
+
if (next === void 0) {
|
|
702
|
+
writeRecord(folder, void 0);
|
|
703
|
+
return moved;
|
|
704
|
+
}
|
|
705
|
+
copyPreset(next, folder);
|
|
706
|
+
recordPreset(folder, next);
|
|
707
|
+
return moved;
|
|
708
|
+
}
|
|
709
|
+
/** A branch plays with the preset of the story it was cut from. */
|
|
710
|
+
function inheritPreset(from, to) {
|
|
711
|
+
const file = join(from, PRESET_RECORD);
|
|
712
|
+
if (existsSync(file)) copyFileSync(file, join(to, PRESET_RECORD));
|
|
713
|
+
}
|
|
714
|
+
// src/shared/timeline.ts
|
|
600
715
|
const emptyTimeline = () => ({
|
|
601
716
|
version: 1,
|
|
602
717
|
head: null,
|
|
@@ -647,8 +762,7 @@ function noticeText(node) {
|
|
|
647
762
|
const ruling = ooc === void 0 ? "" : ooc.question === true ? `\nThe question was answered out of character: ${ooc.note}` : `\nThe command was ruled ${ooc.legal ? "legal" : "illegal and refused"}: ${ooc.note}`;
|
|
648
763
|
return `The story, as it went earlier (restored):\nThe player said: ${node.player}${ruling}\nIt was told to the player:\n${told}`;
|
|
649
764
|
}
|
|
650
|
-
|
|
651
|
-
//#region src/host/timeline/file.ts
|
|
765
|
+
// src/host/timeline/file.ts
|
|
652
766
|
const TIMELINE_FILE = "timeline.json";
|
|
653
767
|
function isNode(value) {
|
|
654
768
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -678,8 +792,7 @@ function writeTimeline(folder, timeline) {
|
|
|
678
792
|
writeFileSync(aside, JSON.stringify(timeline, null, 2));
|
|
679
793
|
renameSync(aside, target);
|
|
680
794
|
}
|
|
681
|
-
|
|
682
|
-
//#region src/host/timeline/branch.ts
|
|
795
|
+
// src/host/timeline/branch.ts
|
|
683
796
|
var BranchError = class extends Error {};
|
|
684
797
|
/**
|
|
685
798
|
* What a branch of a story cut at a log event keeps of the timeline: the turns that ended at or before it, standing at the one
|
|
@@ -729,8 +842,7 @@ function branchName(name) {
|
|
|
729
842
|
const next = start === trimmed.length ? `${name} 2` : `${trimmed.slice(0, start)}${Number(trimmed.slice(start)) + 1}`;
|
|
730
843
|
return next.length > 200 ? `${[...name].slice(0, 190).join("").trimEnd()} 2` : next;
|
|
731
844
|
}
|
|
732
|
-
|
|
733
|
-
//#region src/host/timeline/plan.ts
|
|
845
|
+
// src/host/timeline/plan.ts
|
|
734
846
|
/**
|
|
735
847
|
* Where the model's conversation has to be changed so that it carries the turns from the first to `target`, and no others.
|
|
736
848
|
* A turn is on the conversation when its own message is, or the notice that stands for it. The turns that stay are the longest
|
|
@@ -786,127 +898,7 @@ function planMove(timeline, target, surface) {
|
|
|
786
898
|
inject: path.slice(keptCount)
|
|
787
899
|
};
|
|
788
900
|
}
|
|
789
|
-
|
|
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
|
-
//#region src/host/timeline/service.ts
|
|
901
|
+
// src/host/timeline/service.ts
|
|
910
902
|
/** The text of the marker that stands for the turns it replaces: never empty, as a model service may refuse an empty message. */
|
|
911
903
|
const MARKER_TEXT = "(empty message)";
|
|
912
904
|
/** A turn that has not ended does not know yet where its own message is in the log. */
|
|
@@ -1127,8 +1119,7 @@ var Timelines = class {
|
|
|
1127
1119
|
return childrenOf(timeline, timeline.head);
|
|
1128
1120
|
}
|
|
1129
1121
|
};
|
|
1130
|
-
|
|
1131
|
-
//#region src/host/orchestration/whereabouts.ts
|
|
1122
|
+
// src/host/orchestration/whereabouts.ts
|
|
1132
1123
|
const within = (inner, outer, places) => {
|
|
1133
1124
|
const byId = new Map(places.map((place) => [place.id, place]));
|
|
1134
1125
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1154,8 +1145,7 @@ function whereabouts(places, here, at) {
|
|
|
1154
1145
|
here
|
|
1155
1146
|
};
|
|
1156
1147
|
}
|
|
1157
|
-
|
|
1158
|
-
//#region src/host/memory/reflection.ts
|
|
1148
|
+
// src/host/memory/reflection.ts
|
|
1159
1149
|
const LAST_KEY = "reflection.last";
|
|
1160
1150
|
const CURSOR_KEY = "reflection.cursor";
|
|
1161
1151
|
const ANCHOR_KEY = "reflection.anchor";
|
|
@@ -2036,7 +2026,6 @@ function memoryReflector(deps) {
|
|
|
2036
2026
|
return { characters };
|
|
2037
2027
|
} };
|
|
2038
2028
|
}
|
|
2039
|
-
|
|
2040
|
-
export { referent as _, whereabouts as a, copyPreset as c, switchPreset as d, readTimeline as f, sameWords as g, defaultBoundaries as h, reflectionStatus as i, presetStatus as l, pathTo as m, memoryReflector as n, TimelineError as o, writeTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u };
|
|
2029
|
+
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
2030
|
|
|
2042
|
-
//# sourceMappingURL=reflection-
|
|
2031
|
+
//# sourceMappingURL=reflection-Dg1xtOTW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../dsh-roleplay-model/src/messages-zh.ts
|
|
2
2
|
/** The Chinese of the texts built in code, by the English that stands in the code. A `{name}` is filled in and must stand in both. */
|
|
3
3
|
const ZH = {
|
|
4
4
|
", ": ",",
|
|
@@ -245,6 +245,15 @@ 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
|
+
"The world itself brings in anyone this command calls for, after this turn: do not make them up yourself with expand_world.": "这个指令要求带入的人,由世界自己在本回合之后带入:不要自己用 expand_world 去造。",
|
|
253
|
+
"Passages about making people up:": "关于凭空生成人物的段落:",
|
|
254
|
+
"The player used the world's command /{word}: {description} It is part of the story, not an out-of-character command: play it in the story. The world raises and lowers the command's own flag itself: never change it.": "玩家使用了这个世界的指令 /{word}:{description} 这是故事的一部分,不是角色外的指令:在故事中演绎它。世界会自己升起和放下这个指令的标记:不要去改它。",
|
|
255
|
+
"All the pieces of this card, in order:": "这张卡的所有片段,按顺序:",
|
|
256
|
+
"The standing rules of this world. Apply them on every turn:": "这个世界的常驻规则。每个回合都要遵守:",
|
|
248
257
|
"The instructions of the card:": "卡片的指令:",
|
|
249
258
|
"Characters:": "角色:",
|
|
250
259
|
"Places:": "地点:",
|
|
@@ -260,8 +269,7 @@ const ZH = {
|
|
|
260
269
|
"Description:": "描述:",
|
|
261
270
|
"Creator's notes:": "作者备注:"
|
|
262
271
|
};
|
|
263
|
-
|
|
264
|
-
//#region ../dsh-roleplay-model/src/messages.ts
|
|
272
|
+
// ../dsh-roleplay-model/src/messages.ts
|
|
265
273
|
/** The language a setting such as `zh-CN` or `en` stands for; English when it is none that is known. */
|
|
266
274
|
function languageOf(code) {
|
|
267
275
|
return (code ?? "").trim().toLowerCase().startsWith("zh") ? "zh" : "en";
|
|
@@ -276,8 +284,7 @@ function translator(language) {
|
|
|
276
284
|
const catalogue = language === "en" ? void 0 : CATALOGUES[language];
|
|
277
285
|
return (text, values) => fill(catalogue?.[text] ?? text, values);
|
|
278
286
|
}
|
|
279
|
-
|
|
280
|
-
//#region src/shared/text.ts
|
|
287
|
+
// src/shared/text.ts
|
|
281
288
|
/** Remove characters from either end without a backtracking regular expression. */
|
|
282
289
|
function trimCharacters(value, characters, edge = "both") {
|
|
283
290
|
let start = 0;
|
|
@@ -291,7 +298,6 @@ function withoutExtension(value) {
|
|
|
291
298
|
const dot = value.lastIndexOf(".");
|
|
292
299
|
return dot < 0 ? value : value.slice(0, dot);
|
|
293
300
|
}
|
|
294
|
-
//#endregion
|
|
295
301
|
export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
|
|
296
302
|
|
|
297
|
-
//# sourceMappingURL=text-
|
|
303
|
+
//# sourceMappingURL=text-DyRN4nDP.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { _ as finishOf, g as cutOff } from "./child-
|
|
1
|
+
import { _ as finishOf, g as cutOff } from "./child-lYYeOwl2.js";
|
|
2
|
+
import { d as guardRepeatedCalls } from "./hooks-rQTTeOC4.js";
|
|
2
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
3
|
-
|
|
4
|
-
/** 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
|
-
const MAX_NUDGES = 6;
|
|
4
|
+
// src/host/authoring/turn-guard.ts
|
|
6
5
|
/**
|
|
7
6
|
* 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
7
|
* - 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 +11,7 @@ const MAX_NUDGES = 6;
|
|
|
12
11
|
*/
|
|
13
12
|
function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
14
13
|
const nudged = /* @__PURE__ */ new Map();
|
|
14
|
+
guardRepeatedCalls(ctx, (exec) => exec.agent === void 0 ? void 0 : languageOf(exec.agent.session.id), 3);
|
|
15
15
|
ctx.on("agent/request", async (payload, next) => {
|
|
16
16
|
const config = await next();
|
|
17
17
|
const level = reasoning();
|
|
@@ -36,7 +36,7 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
36
36
|
nudged.delete(key);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (told >=
|
|
39
|
+
if (told >= 6) return;
|
|
40
40
|
nudged.set(key, told + 1);
|
|
41
41
|
agent.steer(createUserMessage({
|
|
42
42
|
content: [{
|
|
@@ -47,7 +47,6 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
47
47
|
}));
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { guardAuthoringTurns as t };
|
|
52
51
|
|
|
53
|
-
//# sourceMappingURL=turn-guard-
|
|
52
|
+
//# sourceMappingURL=turn-guard-g_hDn0jR.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.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",
|
|
@@ -76,39 +76,39 @@
|
|
|
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.2",
|
|
80
80
|
"@dsh-ai-providers/core": "^0.5.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
84
84
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.6",
|
|
85
|
-
"@deepseek-ai/dsh-agent": "0.2.1-rc.
|
|
86
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.1-rc.
|
|
87
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.1-rc.
|
|
88
|
-
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.
|
|
89
|
-
"@deepseek-ai/dsh-client-store": "0.2.1-rc.
|
|
90
|
-
"@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.
|
|
91
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.
|
|
92
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.
|
|
93
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.
|
|
95
|
-
"@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.
|
|
97
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.
|
|
98
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.
|
|
99
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.
|
|
100
|
-
"@deepseek-ai/dsh-compaction": "0.2.1-rc.
|
|
101
|
-
"@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.
|
|
102
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.
|
|
103
|
-
"@deepseek-ai/dsh-llm": "0.2.1-rc.
|
|
104
|
-
"@deepseek-ai/dsh-session": "0.2.1-rc.
|
|
105
|
-
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.
|
|
106
|
-
"@deepseek-ai/dsh-subagent": "0.2.1-rc.
|
|
107
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.
|
|
108
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.
|
|
109
|
-
"@deepseek-ai/dsh-token-meter": "0.2.1-rc.
|
|
110
|
-
"@deepseek-ai/dsh-tools": "0.2.1-rc.
|
|
111
|
-
"@deepseek-ai/dsh-user-approval": "0.2.1-rc.
|
|
85
|
+
"@deepseek-ai/dsh-agent": "0.2.1-rc.5",
|
|
86
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-rc.5",
|
|
87
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.1-rc.5",
|
|
88
|
+
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.5",
|
|
89
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.5",
|
|
91
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.5",
|
|
92
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.5",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.5",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.5",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.5",
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.5",
|
|
98
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.5",
|
|
99
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
|
|
100
|
+
"@deepseek-ai/dsh-compaction": "0.2.1-rc.5",
|
|
101
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.5",
|
|
102
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.5",
|
|
103
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.5",
|
|
104
|
+
"@deepseek-ai/dsh-session": "0.2.1-rc.5",
|
|
105
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.5",
|
|
106
|
+
"@deepseek-ai/dsh-subagent": "0.2.1-rc.5",
|
|
107
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.5",
|
|
108
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
|
|
109
|
+
"@deepseek-ai/dsh-token-meter": "0.2.1-rc.5",
|
|
110
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.5",
|
|
111
|
+
"@deepseek-ai/dsh-user-approval": "0.2.1-rc.5",
|
|
112
112
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
113
113
|
"@types/node": "^22.20.0",
|
|
114
114
|
"@types/react": "~18.3.1",
|
|
@@ -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: arrival when the new person comes into the scene from outside, introduction when someone who is already around is brought into play.
|
|
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}
|
|
@@ -4,4 +4,5 @@ You write one character of a role-playing world, from pieces of a character card
|
|
|
4
4
|
- start: how they are when the story begins: what others can see (public_state), what they think and feel (inner_state), what they are doing (activity), the place they are in (location: a name from the list of places) and where in it (position, in words). Only when the pieces say.
|
|
5
5
|
- goals: what they want or are driving at, when the pieces say. relationships: how they stand towards others of the list: with (a name from the list of characters), label (a word or two), summary.
|
|
6
6
|
- tier: principal for someone the story is about, supporting for a recurring character, background for someone who only appears. kind: person, or group for a crowd or party that acts as one.
|
|
7
|
+
- carries: the things they have on them at the start (a weapon, a tool, a document, a keepsake), by the name the text gives them; things they only know of go in knows, not here.
|
|
7
8
|
- knows: the places and things of the lists that they know of, when the pieces say they do (places they have been to or live by, things they own, carry or have seen); not everything of the world, and not what they could only have learned later. ways: ways between two places of the list (from, to) that they know how to take, when the pieces say they have used or been shown them.
|
|
@@ -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.
|