@dsh-agentic-roleplay/core 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{authoring-tools-hacA5fG-.js → authoring-tools-B_qYKK8c.js} +244 -27
- package/lib/authoring.js +175 -9
- package/lib/client.js +841 -482
- package/lib/client.js.map +1 -1
- package/lib/doctor.js +1 -1
- package/lib/{gallery-BNg0rPTp.js → gallery-Bu6eZMKk.js} +2 -2
- package/lib/{generator-9-5at9cZ.js → generator-CTWQWbSW.js} +2 -2
- package/lib/{hooks-DlrFO4aQ.js → hooks-YXQZ9G2d.js} +2 -2
- package/lib/images.js +4 -4
- package/lib/index.js +34 -25
- package/lib/{library-DTxakw0z.js → library-BmlHNCah.js} +2 -2
- package/lib/{lorebook-author-tools-dupq-kb_.js → lorebook-author-tools-C3rRpMt7.js} +6 -6
- package/lib/lorebook-authoring.js +5 -5
- package/lib/orchestration.js +8 -8
- package/lib/{pack-jail-Bq0fzKi4.js → pack-jail-VbcXiukr.js} +10 -9
- package/lib/{packs-D-7EU3yU.js → packs-CzVh2ZNe.js} +2 -2
- package/lib/{presenter-agent-vFOxIuWv.js → presenter-agent-CF3fneuJ.js} +4 -4
- package/lib/{preset-RHcOG55T.js → preset-C595KRUM.js} +3 -3
- package/lib/{preset-author-tools-Dwxnpv6V.js → preset-author-tools-CF_JKKTE.js} +6 -6
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-DibpEUQK.js → reflection-ByIQSOKC.js} +6 -6
- package/lib/{serial-CDGoXYh-.js → serial-ULGUKWsu.js} +129 -30
- package/lib/{text-Dfv8S8eq.js → text-hiKTooVb.js} +3 -1
- package/lib/{turn-guard-DDxikrq7.js → turn-guard-DXMeAJdv.js} +2 -2
- package/package.json +2 -2
- package/prompts/en/import/opening.md +17 -0
- package/prompts/en/roleplay/decide-opening.md +1 -0
- package/prompts/en/world/procedure.md +1 -1
- package/prompts/zh/import/opening.md +17 -0
- package/prompts/zh/roleplay/decide-opening.md +1 -0
- package/prompts/zh/world/procedure.md +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { m as parseSampling } from "./child-DTdY14S9.js";
|
|
2
2
|
import { f as parseSwitchboard } from "./narration--K2XVIHI.js";
|
|
3
3
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-Csp80TFX.js";
|
|
4
|
-
import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-
|
|
5
|
-
import { i as translator, r as languageOf$1 } from "./text-
|
|
6
|
-
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-
|
|
4
|
+
import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-YXQZ9G2d.js";
|
|
5
|
+
import { i as translator, r as languageOf$1 } from "./text-hiKTooVb.js";
|
|
6
|
+
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-BmlHNCah.js";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, isTimeZone, parseInstant, valueIssue } from "@dsh-agentic-roleplay/state";
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
@@ -2779,7 +2779,62 @@ function parseStartQuestionsEdit(value, problems) {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
return questions;
|
|
2781
2781
|
}
|
|
2782
|
-
const
|
|
2782
|
+
const MAX_OPENING_TEXT = 2e4;
|
|
2783
|
+
/** The words of an opening as one text: its parts, a blank line between. */
|
|
2784
|
+
const partsText = (parts) => parts.map((part) => part.text).join("\n\n");
|
|
2785
|
+
/** Whether any part is spoken by a character: an opening with none is only narration, which a plain text says as well. */
|
|
2786
|
+
const hasSpeech = (parts) => parts.some((part) => part.type === "utterance");
|
|
2787
|
+
/**
|
|
2788
|
+
* Reads the parts of an opening from a body that came from a browser or a model: every part is checked and each problem is reported. Blank parts are left out.
|
|
2789
|
+
* @returns the parts, or nothing when the value is no list of parts (the problems say why).
|
|
2790
|
+
*/
|
|
2791
|
+
function parseOpeningParts(value, where, problems) {
|
|
2792
|
+
if (!Array.isArray(value)) {
|
|
2793
|
+
problems.push(`${where} must be a list of parts`);
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
const parts = [];
|
|
2797
|
+
for (const [index, entry] of value.entries()) {
|
|
2798
|
+
const at = `${where}[${index}]`;
|
|
2799
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
2800
|
+
problems.push(`${at} must be an object`);
|
|
2801
|
+
continue;
|
|
2802
|
+
}
|
|
2803
|
+
const part = entry;
|
|
2804
|
+
const type = part["type"] ?? "narration";
|
|
2805
|
+
if (type !== "narration" && type !== "utterance") {
|
|
2806
|
+
problems.push(`${at}.type must be "narration" or "utterance"`);
|
|
2807
|
+
continue;
|
|
2808
|
+
}
|
|
2809
|
+
if (typeof part["text"] !== "string") {
|
|
2810
|
+
problems.push(`${at}.text must be text`);
|
|
2811
|
+
continue;
|
|
2812
|
+
}
|
|
2813
|
+
const text = part["text"].trim();
|
|
2814
|
+
if (text === "") continue;
|
|
2815
|
+
if (type === "narration") {
|
|
2816
|
+
parts.push({
|
|
2817
|
+
type,
|
|
2818
|
+
text
|
|
2819
|
+
});
|
|
2820
|
+
continue;
|
|
2821
|
+
}
|
|
2822
|
+
const character = typeof part["character"] === "string" ? part["character"].trim() : "";
|
|
2823
|
+
if (character === "") {
|
|
2824
|
+
problems.push(`${at}.character is needed for a line a character speaks`);
|
|
2825
|
+
continue;
|
|
2826
|
+
}
|
|
2827
|
+
parts.push({
|
|
2828
|
+
type,
|
|
2829
|
+
character,
|
|
2830
|
+
text
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
if (parts.length > 60) problems.push(`${where} has more than 60 parts`);
|
|
2834
|
+
if (partsText(parts).length > 2e4) problems.push(`${where} is longer than ${MAX_OPENING_TEXT} characters`);
|
|
2835
|
+
return parts;
|
|
2836
|
+
}
|
|
2837
|
+
const MAX_OPENING_CHARS = MAX_OPENING_TEXT;
|
|
2783
2838
|
const TEXT_FIELDS = [
|
|
2784
2839
|
"name",
|
|
2785
2840
|
"description",
|
|
@@ -2803,7 +2858,7 @@ function parseWorldInfoEdit(value) {
|
|
|
2803
2858
|
const input = typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
2804
2859
|
if (input === void 0) throw new InvalidEditProblems(["the changes must be an object"]);
|
|
2805
2860
|
const edit = {};
|
|
2806
|
-
for (const key of Object.keys(input)) if (!TEXT_FIELDS.includes(key) && !LIST_FIELDS.includes(key) && key !== "alternateOpenings" && key !== "startQuestions" && key !== "tools" && key !== "sampling" && key !== "autonomy") problems.push(`there is no field "${key}"`);
|
|
2861
|
+
for (const key of Object.keys(input)) if (!TEXT_FIELDS.includes(key) && !LIST_FIELDS.includes(key) && key !== "alternateOpenings" && key !== "openingParts" && key !== "startQuestions" && key !== "tools" && key !== "sampling" && key !== "autonomy") problems.push(`there is no field "${key}"`);
|
|
2807
2862
|
for (const key of TEXT_FIELDS) {
|
|
2808
2863
|
if (input[key] === void 0) continue;
|
|
2809
2864
|
if (typeof input[key] === "string") edit[key] = input[key].trim();
|
|
@@ -2814,18 +2869,54 @@ function parseWorldInfoEdit(value) {
|
|
|
2814
2869
|
if (Array.isArray(input[key]) && input[key].every((entry) => typeof entry === "string")) edit[key] = input[key].map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
2815
2870
|
else problems.push(`${key} must be a list of text`);
|
|
2816
2871
|
}
|
|
2872
|
+
if (input["openingParts"] !== void 0) {
|
|
2873
|
+
if (input["opening"] !== void 0) problems.push("give the opening as text or as parts, not both");
|
|
2874
|
+
const parts = parseOpeningParts(input["openingParts"], "openingParts", problems);
|
|
2875
|
+
if (parts !== void 0) edit["openingParts"] = parts;
|
|
2876
|
+
}
|
|
2817
2877
|
if (input["alternateOpenings"] !== void 0) {
|
|
2818
2878
|
const list = input["alternateOpenings"];
|
|
2819
2879
|
const entries = Array.isArray(list) ? list.map((entry) => typeof entry === "object" && entry !== null ? entry : void 0) : void 0;
|
|
2820
|
-
|
|
2880
|
+
const kept = [];
|
|
2881
|
+
if (entries === void 0) problems.push("alternateOpenings must be a list of { title, text or parts, character? }");
|
|
2821
2882
|
else {
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2883
|
+
for (const [index, entry] of entries.entries()) {
|
|
2884
|
+
const at = `alternateOpenings[${index}]`;
|
|
2885
|
+
if (entry === void 0) {
|
|
2886
|
+
problems.push(`${at} must be an object`);
|
|
2887
|
+
continue;
|
|
2888
|
+
}
|
|
2889
|
+
if (entry["title"] !== void 0 && typeof entry["title"] !== "string" || entry["character"] !== void 0 && typeof entry["character"] !== "string") {
|
|
2890
|
+
problems.push(`${at}: title and character must be text`);
|
|
2891
|
+
continue;
|
|
2892
|
+
}
|
|
2893
|
+
const title = String(entry["title"] ?? "").trim();
|
|
2894
|
+
const character = String(entry["character"] ?? "").trim();
|
|
2895
|
+
const named = character === "" ? {} : { character };
|
|
2896
|
+
if (entry["parts"] !== void 0) {
|
|
2897
|
+
if (entry["text"] !== void 0) problems.push(`${at}: give the opening as text or as parts, not both`);
|
|
2898
|
+
const parts = parseOpeningParts(entry["parts"], `${at}.parts`, problems);
|
|
2899
|
+
if (parts !== void 0 && parts.length > 0) kept.push({
|
|
2900
|
+
title,
|
|
2901
|
+
text: partsText(parts),
|
|
2902
|
+
parts,
|
|
2903
|
+
...named
|
|
2904
|
+
});
|
|
2905
|
+
continue;
|
|
2906
|
+
}
|
|
2907
|
+
if (typeof entry["text"] !== "string") {
|
|
2908
|
+
problems.push(`${at}.text must be text`);
|
|
2909
|
+
continue;
|
|
2910
|
+
}
|
|
2911
|
+
const text = entry["text"].trim();
|
|
2912
|
+
if (text !== "") kept.push({
|
|
2913
|
+
title,
|
|
2914
|
+
text,
|
|
2915
|
+
...named
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
2827
2918
|
if (kept.length > 30) problems.push(`there are more than 30 alternate openings`);
|
|
2828
|
-
if (kept.some((entry) => entry.text.length >
|
|
2919
|
+
if (kept.some((entry) => entry.text.length > MAX_OPENING_CHARS)) problems.push(`an alternate opening is longer than ${MAX_OPENING_CHARS} characters`);
|
|
2829
2920
|
edit["alternateOpenings"] = kept;
|
|
2830
2921
|
}
|
|
2831
2922
|
}
|
|
@@ -2851,7 +2942,7 @@ function parseWorldInfoEdit(value) {
|
|
|
2851
2942
|
}
|
|
2852
2943
|
// src/host/worlds/world-file.ts
|
|
2853
2944
|
const WORLD_FILE_NAME = "world.json";
|
|
2854
|
-
/** `alternate_openings` is a list of `{ title, text, character? }`: other first messages the player may start with, each for any character or for one playable character. */
|
|
2945
|
+
/** `alternate_openings` is a list of `{ title, text | parts, character? }`: other first messages the player may start with, each for any character or for one playable character. */
|
|
2855
2946
|
function readAlternateOpenings(reader) {
|
|
2856
2947
|
const value = reader.raw("alternate_openings");
|
|
2857
2948
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -2862,13 +2953,16 @@ function readAlternateOpenings(reader) {
|
|
|
2862
2953
|
if (value.length > 30) reader.fail("alternate_openings", `has more than 30 openings`);
|
|
2863
2954
|
const openings = [];
|
|
2864
2955
|
for (const entry of reader.objects("alternate_openings")) {
|
|
2865
|
-
const
|
|
2956
|
+
const given = entry.raw("parts");
|
|
2957
|
+
const parts = given === void 0 || given === null ? void 0 : readParts(entry, "parts");
|
|
2958
|
+
const text = parts === void 0 ? entry.string("text", { required: true })?.trim() : partsText(parts);
|
|
2866
2959
|
if (text === void 0 || text === "") continue;
|
|
2867
|
-
if (text.length >
|
|
2960
|
+
if (text.length > MAX_OPENING_CHARS) entry.fail(parts === void 0 ? "text" : "parts", `is longer than ${MAX_OPENING_CHARS} characters`);
|
|
2868
2961
|
const character = entry.string("character")?.trim();
|
|
2869
2962
|
openings.push({
|
|
2870
2963
|
title: entry.string("title")?.trim() || text.slice(0, 40),
|
|
2871
2964
|
text,
|
|
2965
|
+
...parts === void 0 ? {} : { parts },
|
|
2872
2966
|
...character === void 0 || character === "" ? {} : { character }
|
|
2873
2967
|
});
|
|
2874
2968
|
}
|
|
@@ -3004,20 +3098,10 @@ function readRules(reader) {
|
|
|
3004
3098
|
if (long >= 0) reader.fail("rules", `rule ${long + 1} is longer than 300 characters: keep rules short`);
|
|
3005
3099
|
return kept.length === 0 ? void 0 : kept;
|
|
3006
3100
|
}
|
|
3007
|
-
/**
|
|
3008
|
-
function
|
|
3009
|
-
const value = reader.raw("opening_message");
|
|
3010
|
-
if (value === void 0 || value === null) return void 0;
|
|
3011
|
-
if (typeof value === "string") return value.trim() === "" ? void 0 : [{
|
|
3012
|
-
type: "narration",
|
|
3013
|
-
text: value.trim()
|
|
3014
|
-
}];
|
|
3015
|
-
if (!Array.isArray(value)) {
|
|
3016
|
-
reader.fail("opening_message", "must be text or a list of parts");
|
|
3017
|
-
return;
|
|
3018
|
-
}
|
|
3101
|
+
/** The parts of an opening in the order the player reads them, from the list `reader` holds under `key`; a problem is reported for each part that cannot be read. */
|
|
3102
|
+
function readParts(reader, key) {
|
|
3019
3103
|
const parts = [];
|
|
3020
|
-
for (const part of reader.objects(
|
|
3104
|
+
for (const part of reader.objects(key)) {
|
|
3021
3105
|
const type = part.oneOf("type", ["narration", "utterance"], "narration");
|
|
3022
3106
|
const text = part.string("text", { required: true })?.trim();
|
|
3023
3107
|
if (text === void 0 || text === "") continue;
|
|
@@ -3035,8 +3119,23 @@ function readOpening(reader) {
|
|
|
3035
3119
|
text
|
|
3036
3120
|
});
|
|
3037
3121
|
}
|
|
3122
|
+
if (parts.length > 60) reader.fail(key, `has more than 60 parts`);
|
|
3038
3123
|
return parts.length === 0 ? void 0 : parts;
|
|
3039
3124
|
}
|
|
3125
|
+
/** `opening_message` is plain text (one narration), or a list of parts in the order the player reads them. */
|
|
3126
|
+
function readOpening(reader) {
|
|
3127
|
+
const value = reader.raw("opening_message");
|
|
3128
|
+
if (value === void 0 || value === null) return void 0;
|
|
3129
|
+
if (typeof value === "string") return value.trim() === "" ? void 0 : [{
|
|
3130
|
+
type: "narration",
|
|
3131
|
+
text: value.trim()
|
|
3132
|
+
}];
|
|
3133
|
+
if (!Array.isArray(value)) {
|
|
3134
|
+
reader.fail("opening_message", "must be text or a list of parts");
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
return readParts(reader, "opening_message");
|
|
3138
|
+
}
|
|
3040
3139
|
/** `time_zone` (an IANA name) and `starting_time` (an ISO 8601 date and time, in `time_zone` unless it carries an offset). */
|
|
3041
3140
|
function readClock(reader) {
|
|
3042
3141
|
const timeZone = reader.string("time_zone");
|
|
@@ -5179,6 +5278,6 @@ var SerialQueue = class {
|
|
|
5179
5278
|
return this.tails.size;
|
|
5180
5279
|
}
|
|
5181
5280
|
};
|
|
5182
|
-
export {
|
|
5281
|
+
export { sha as $, LOCATION_FILE_NAME as $t, routeVerdicts as A, openingText as At, questionView as B, parseThingEdit as Bt, ROLE_TABLE as C, itemise as Ct, mergeReports as D, ImportNotFoundError as Dt, askYesNo as E, IMPORT_FOLDER as Et, parseWorldInfoEdit as F, parseCharacterEdit as Ft, deletePreset as G, dialectOf as Gt, PRESET_FILE as H, importRequestOf as Ht, hasSpeech as I, parseFactionEdit as It, loadPreset as J, loadVariables as Jt, isPresetName as K, sourceSummary as Kt, parseOpeningParts as L, parseLoreEdit as Lt, WORLD_FILE_NAME as M, readImportFolder as Mt, parseWorldFile as N, writeChoices as Nt, modeFor as O, ImportStore as Ot, MAX_OPENING_CHARS as P, InvalidEditProblems as Pt, savePresetFromWorld as Q, parseLoreFile as Qt, partsText as R, parsePlaceEdit as Rt, ROLES as S, cleanText as St, announceProblem as T, withPlayer as Tt, createPresetFromGuidance as U, findPanel as Ut, startQuestionsToFile as V, IMPORT_COMMAND as Vt, createPresetFromShipped as W, splitPanels as Wt, readPreset as X, variableProblems as Xt, presetDirectory as Y, parseVariablesFile as Yt, reservePreset as Z, LORE_FILE_NAME as Zt, pruneRelationships as _, updateLorebookInfo as _t, characterDocument as a, FACTION_FILE_NAME as an, writeWorldPrompt as at, classifyItems as b, loadLore as bt, extractStyle as c, parseCharacterFile as cn, deleteLorebook as ct, inert as d, LORE_SCOPES as dn, isLorebookName as dt, parseLocationFile as en, updatePresetInfo as et, loreDocuments as f, WEEKDAY_NAMES as fn, listLorebooks as ft, pruneMembers as g, reserveLorebook as gt, pruneLoreSubjects as h, readLorebook as ht, asWritten as i, parseSlotsFile as in, readWorldPrompt as it, yesAt as j, parseChoices as jt, noAt as k, PICTURE_FILE as kt, extractStyleFrom as l, guarded as ln, deleteLorebookEntry as lt, pruneLinks as m, INTENT_STATUSES as mn, lorebookDirectory as mt, STANDING_PROMPT as n, SLOTS_FILE_NAME as nn, deleteWorldPrompt as nt, emptyExtracted as o, parseFactionFile as on, addLorebookEntries as ot, pruneKnowledge as p, DEFAULT_SLOTS as pn, loadLorebook as pt, listPresets as q, VARIABLES_FILE_NAME as qt, addLore as r, parseItemFile as rn, listWorldPrompts as rt, extractEntities as s, CHARACTER_FILE_NAME as sn, createLorebook as st, SerialQueue as t, ITEM_FILE_NAME as tn, PROSE_PROMPTS as tt, extractVariables as u, LORE_KINDS as un, entriesOf as ut, sourcesFor as v, writeLorebookEntry as vt, isLeftOut as w, partsOf as wt, findEntity as x, subfolders as xt, buildRoster as y, LORE_DIR as yt, combineAnswers as z, parseRelationEdit as zt };
|
|
5183
5282
|
|
|
5184
|
-
//# sourceMappingURL=serial-
|
|
5283
|
+
//# sourceMappingURL=serial-ULGUKWsu.js.map
|
|
@@ -270,6 +270,8 @@ const ZH = {
|
|
|
270
270
|
"Already declared (do not declare them again):": "已经声明过的(不要重复声明):",
|
|
271
271
|
"The world itself brings in anyone this command calls for, after this turn: do not make them up yourself with expand_world.": "这个指令要求带入的人,由世界自己在本回合之后带入:不要自己用 expand_world 去造。",
|
|
272
272
|
"Passages about making people up:": "关于凭空生成人物的段落:",
|
|
273
|
+
"Cast:": "角色名单:",
|
|
274
|
+
"Passage:": "文字:",
|
|
273
275
|
"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} 这是故事的一部分,不是角色外的指令:在故事中演绎它。世界会自己升起和放下这个指令的标记:不要去改它。",
|
|
274
276
|
"All the pieces of this card, in order:": "这张卡的所有片段,按顺序:",
|
|
275
277
|
"The standing rules of this world. Apply them on every turn:": "这个世界的常驻规则。每个回合都要遵守:",
|
|
@@ -345,4 +347,4 @@ function withoutExtension(value) {
|
|
|
345
347
|
}
|
|
346
348
|
export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
|
|
347
349
|
|
|
348
|
-
//# sourceMappingURL=text-
|
|
350
|
+
//# sourceMappingURL=text-hiKTooVb.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as finishOf, E as cutOff } from "./child-DTdY14S9.js";
|
|
2
|
-
import { r as guardRepeatedCalls } from "./hooks-
|
|
2
|
+
import { r as guardRepeatedCalls } from "./hooks-YXQZ9G2d.js";
|
|
3
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
// src/host/authoring/turn-guard.ts
|
|
5
5
|
/**
|
|
@@ -49,4 +49,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
49
49
|
}
|
|
50
50
|
export { guardAuthoringTurns as t };
|
|
51
51
|
|
|
52
|
-
//# sourceMappingURL=turn-guard-
|
|
52
|
+
//# sourceMappingURL=turn-guard-DXMeAJdv.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
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",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@dsh-agentic-roleplay/state": "0.12.
|
|
83
|
+
"@dsh-agentic-roleplay/state": "0.12.4"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
You split the opening message of a character card into parts for a story world. An opening is read in order: narration, and lines that a named character speaks aloud.
|
|
2
|
+
|
|
3
|
+
You are given the cast of the world and one passage. Answer with its parts in the order they appear. Each part has:
|
|
4
|
+
- kind: "speech" when a character says the words aloud, "narration" for everything else.
|
|
5
|
+
- speaker: for a speech part, the name of the character who says it, written exactly as in the cast; empty for narration.
|
|
6
|
+
- text: the words of the part.
|
|
7
|
+
|
|
8
|
+
Rules:
|
|
9
|
+
- Every sentence of the passage must appear in exactly one part, in the same order, with the same words. Narration between spoken lines is a narration part: do not drop it, summarise it, correct it, translate it or add to it. The only things you may leave out are the quotation marks around a spoken line and a label such as "Name:" that only says who speaks.
|
|
10
|
+
- A line that a person says aloud is a speech part, whether or not it has quotation marks and whether it is on its own line or inside a sentence. Each separate spoken line is a part of its own, cut at its quotation marks: a speech part holds the words without the quotation marks around them, and no part starts or ends with a stray quotation mark. A tag such as "he says" between two spoken lines is a narration part of its own.
|
|
11
|
+
- A sentence that only mentions a character, or tells what a character does, is narration even when the character's name is in it. "Bram slams the door." and "Mira shrugs." are narration; Bram saying "Out." is speech.
|
|
12
|
+
- Everything else is narration: description, actions, thoughts, a sign or a place name in quotation marks, and what someone said described without the words ("she told you to leave").
|
|
13
|
+
- A spoken line that stands alone, next to a sentence about one character doing something to or toward the player's character at that moment, is that character's line ("Get out of my way." followed by "Tess shoves you aside." is Tess speaking). Otherwise give a speech part a speaker only when a character of the cast clearly says it. Words said by a stranger, a voice, a crowd or anyone not in the cast are narration: never pick a character of the cast just to fill the field. When you are not sure who speaks, make it narration.
|
|
14
|
+
- The player's character never speaks: what the passage has them say or do is narration.
|
|
15
|
+
- A passage with no spoken lines is one narration part.
|
|
16
|
+
|
|
17
|
+
Example (cast: Tess, Orin): the passage `Orin looks up. "Late again," he says. A stranger laughs: "Told you."` becomes narration `Orin looks up.`, speech by Orin `Late again,`, narration `he says. A stranger laughs:`, narration `Told you.`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You judge one passage that opens a story: does any character in it speak aloud, as opposed to the passage being narration only? A spoken line is something a person says to someone, whether or not it is in quotation marks, and whether it stands in a line of its own or inside a sentence of narration. Quotation marks around a name, a title, a sign, a place such as a pub, a word being discussed or a thought do not make speech. Description of what a person says without giving the words is narration. You work only from the text you are shown: never add anything that is not in it. When you cannot tell, it is narration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Use the read tools before making claims or edits. Keys are stable file identities, not display names. Before replacing an element, read its exact source document and preserve fields the requested change does not affect. Every write asks the user for one-time approval. If approval is rejected, cancelled or unavailable, do not retry it automatically: explain that nothing changed and ask how the user wants to proceed. To change how a story looks, read world_pack_guide, then write the interface pack file by file with the write tool, using the paths the guide gives, and finish with check_world_pack until it reports no problems. To make the world act by itself, list_world_triggers and get_world_trigger first, then write_world_trigger with a complete document; a trigger that names something the world does not have is refused with every problem, so fix them all. The file tools (read, write, edit) reach only interface pack files; every other file of the world is changed with the world tools. Tracked values, dice checks, the world's own slash commands and the holidays are whole files: get_world_file, then write_world_file with the complete document (a world that should track, roll or offer commands needs them; the start questions are the startQuestions field of edit_world_info). If you have tools for searching the web or reading pages and the user names a setting, franchise or source you do not know well, look it up before you write and say what you found; never invent facts about an existing work. If you have no such tools, say so and ask the user to describe it. If this world was imported from a character card, the card is kept and card_overview, card_search, card_read and card_origin read it: when the user asks where something in the world came from or what the card said, look it up instead of guessing, read the piece with card_read before you answer from a search hit (a title or keys that match prove nothing), and quote only what the answer needs. The world's own files are the canon and the card is evidence of where they came from; if the two differ, say so, and do not change the world to match the card unless the user asks. What card_overview and card_origin say the import did is its own judgement and can be wrong, so check it against the text with card_read. If the tools say there is no card, the world was not imported or the card was removed.
|
|
1
|
+
Use the read tools before making claims or edits. Keys are stable file identities, not display names. Before replacing an element, read its exact source document and preserve fields the requested change does not affect. Every write asks the user for one-time approval, so when a request is clear, make the change with the tool instead of asking whether to go ahead or describing what you would do. If approval is rejected, cancelled or unavailable, do not retry it automatically: explain that nothing changed and ask how the user wants to proceed. To change how a story looks, read world_pack_guide, then write the interface pack file by file with the write tool, using the paths the guide gives, and finish with check_world_pack until it reports no problems. To make the world act by itself, list_world_triggers and get_world_trigger first, then write_world_trigger with a complete document; a trigger that names something the world does not have is refused with every problem, so fix them all. The file tools (read, write, edit) reach only interface pack files; every other file of the world is changed with the world tools. Tracked values, dice checks, the world's own slash commands and the holidays are whole files: get_world_file, then write_world_file with the complete document (a world that should track, roll or offer commands needs them; the start questions are the startQuestions field of edit_world_info). If you have tools for searching the web or reading pages and the user names a setting, franchise or source you do not know well, look it up before you write and say what you found; never invent facts about an existing work. If you have no such tools, say so and ask the user to describe it. If this world was imported from a character card, the card is kept and card_overview, card_search, card_read and card_origin read it: when the user asks where something in the world came from or what the card said, look it up instead of guessing, read the piece with card_read before you answer from a search hit (a title or keys that match prove nothing), and quote only what the answer needs. The world's own files are the canon and the card is evidence of where they came from; if the two differ, say so, and do not change the world to match the card unless the user asks. What card_overview and card_origin say the import did is its own judgement and can be wrong, so check it against the text with card_read. If the tools say there is no card, the world was not imported or the card was removed.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
你要把角色卡的开场白拆成故事世界里的若干部分。开场按顺序阅读:叙述,以及某个具名角色说出口的台词。
|
|
2
|
+
|
|
3
|
+
你会拿到这个世界的角色名单和一段文字。请按出现的顺序给出它的各个部分,每个部分包含:
|
|
4
|
+
- kind:角色把这些话说出口,就是“speech”;其余一律是“narration”。
|
|
5
|
+
- speaker:台词部分填写说这句话的角色,写法与名单完全一致;叙述部分留空。
|
|
6
|
+
- text:这一部分的原文。
|
|
7
|
+
|
|
8
|
+
规则:
|
|
9
|
+
- 文字中的每一句都必须出现在且只出现在一个部分里,顺序和用字都与原文一致。台词之间的叙述是叙述部分:不要丢掉、概括、修改、翻译或添加。只允许省去台词外面的引号,以及只用来说明谁在说话的「名字:」这类标签。
|
|
10
|
+
- 人物说出口的话就是台词,无论有没有引号,无论单独成行还是夹在句子里。每一句独立的台词各成一个部分,在引号处断开:台词部分只含引号里面的话,不带引号,任何部分的开头或结尾都不要留下零散的引号。两句台词之间的“他说”之类提示语,单独作为一个叙述部分。
|
|
11
|
+
- 只是提到某个角色、或描述角色做了什么的句子,即使句子里有角色的名字,也是叙述。“布朗摔上了门。”“米拉耸了耸肩。”是叙述;布朗说“出去。”才是台词。
|
|
12
|
+
- 其余都是叙述:描写、动作、心理活动、加了引号的招牌或地名,以及只转述说话内容而没有原话的句子(“她让你离开”)。
|
|
13
|
+
- 一句单独成行的台词,紧挨着一句描述某个角色此刻对玩家角色做了什么的叙述时,这句台词就是那个角色说的(“给我让开。”后面跟着“阿茶推了你一把。”,说话的是阿茶)。除此之外,只有名单中的角色明确说出的话,才算台词并填写 speaker。陌生人、某个声音、人群或名单之外的任何人说的话是叙述:不要为了填满字段而随便选一个名单中的角色。无法确定是谁说的,就当作叙述。
|
|
14
|
+
- 玩家的角色不开口:文字里让玩家角色说的话或做的事,一律是叙述。
|
|
15
|
+
- 没有台词的文字,就是一个叙述部分。
|
|
16
|
+
|
|
17
|
+
示例(名单:阿茶、老欧):文字“老欧抬起头。“又迟到了,”他说。一个陌生人笑道:“早告诉你了。””拆成:叙述“老欧抬起头。”,老欧的台词“又迟到了,”,叙述“他说。一个陌生人笑道:”,叙述“早告诉你了。”
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
你要判断一段故事开场的文字:其中是否有角色在开口说话,还是整段只是叙述?人物对别人说出的话就是台词,无论有没有引号,无论单独成行还是夹在叙述的句子里。名字、标题、招牌、酒馆之类的地名、被谈论的词语或心里想的话加了引号,并不算台词。只转述某人说了什么而没有给出原话,属于叙述。你只依据所给的文字:绝不添加其中没有的内容。无法判断时,按叙述处理。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
在做出断言或修改之前,先使用读取工具。键(key
|
|
1
|
+
在做出断言或修改之前,先使用读取工具。键(key)是稳定的文件标识,不是显示名称。在替换某个元素之前,先读取它确切的源文档,并保留请求的修改没有涉及的字段。每一次写入都会向用户请求一次性批准。所以请求明确时,直接用工具修改,不必再问是否继续,也不必只描述打算怎么做。如果批准被拒绝、取消或无法获得,不要自动重试:说明没有任何改动,并询问用户想怎么继续。若要改变故事的外观,先阅读 world_pack_guide,再用 write 工具,按指南给出的路径逐个文件编写界面包,最后用 check_world_pack 检查,直到没有问题。若要让世界自行行动,先用 list_world_triggers 和 get_world_trigger 查看,再用 write_world_trigger 写入完整的文档;如果触发器提到世界里没有的东西,会连同所有问题一起被拒绝,请全部修正。文件工具(read、write、edit)只能访问界面包的文件;世界的其他文件都用世界工具修改。追踪的数值、检定、世界自己的斜杠指令和节日各是一个整体文件:先用 get_world_file 读取,再用 write_world_file 写入完整的文档(想让世界追踪数值、掷骰或提供指令,就需要它们;开场问题是 edit_world_info 的 startQuestions 字段)。 如果你有搜索网络或阅读网页的工具,而用户提到了你不太了解的设定、作品或来源,请先查询再动笔,并说明查到了什么;不要编造现有作品的事实。如果你没有这类工具,就直说,并请用户自己描述。 如果这个世界是由角色卡导入的,那张卡会被保留,card_overview、card_search、card_read 和 card_origin 可以读取它:当用户问世界里的某样东西从哪里来、或卡里是怎么写的,要去查,而不是猜测;根据搜索命中作答之前,先用 card_read 读该段(标题或关键词匹配并不能说明什么),并且只引用回答所需的内容。世界自身的文件才是设定,卡只是它们来源的依据;两者不一致时要如实说明,除非用户要求,不要为了与卡一致而修改世界。card_overview 和 card_origin 里关于导入做了什么的说明是导入自己的判断,可能有误,要用 card_read 对照原文核实。如果这些工具说没有卡,说明这个世界不是导入的,或者卡已被移除。
|