@dsh-agentic-roleplay/core 0.9.1 → 0.10.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/{access-CfQWbNZP.js → access-CXtaZNbx.js} +50 -2
- package/lib/{authoring-tools-C_l07RYn.js → authoring-tools-C6Hzy8jU.js} +1571 -1301
- package/lib/authoring.js +19 -8
- package/lib/{child-lYYeOwl2.js → child-C8r8AFpm.js} +150 -14
- package/lib/client.js +6295 -3329
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/doctor.js +3 -3
- package/lib/{gallery-q7niLtWn.js → gallery-CtG-bDzz.js} +5 -9
- package/lib/{generator-BpjPrvHe.js → generator-nLoPM5MF.js} +2 -2
- package/lib/helper.js +1 -1
- package/lib/{hooks-DNaDzMjW.js → hooks-BuQ61nvQ.js} +207 -56
- package/lib/images.js +4 -4
- package/lib/index.js +1312 -125
- package/lib/{library-CIkxhf_R.js → library-CH-ahlm0.js} +7 -14
- package/lib/{lorebook-author-tools-BiMDmdFi.js → lorebook-author-tools-B6_Jj8oe.js} +7 -7
- package/lib/lorebook-authoring.js +4 -4
- package/lib/{narration-CjB_KwwY.js → narration-B0hConSw.js} +11 -53
- package/lib/orchestration.js +196 -14
- package/lib/{pack-jail-B35Vx3hT.js → pack-jail-OZSgU85i.js} +11 -11
- package/lib/{packs-BajKw7S9.js → packs-B88bxt8E.js} +2 -2
- package/lib/{presenter-agent-jgtuTwZr.js → presenter-agent-D-WNs626.js} +12 -17
- package/lib/{preset-DWgkcPau.js → preset-DNuqvMan.js} +4 -4
- package/lib/{preset-author-tools-BhuYIKms.js → preset-author-tools-CDwavcTb.js} +7 -7
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-9GzaSELc.js → presets-9_MNxwaw.js} +105 -10
- package/lib/{reflection-4L0Plvct.js → reflection-BvM0w1R4.js} +179 -112
- package/lib/{text-CbGQhK1-.js → text-CzqhC8sT.js} +11 -1
- package/lib/{turn-guard-sCUXmp-5.js → turn-guard-Ygdww1Wt.js} +3 -3
- package/package.json +2 -2
- package/prompts/en/checks/conflict.md +1 -1
- package/prompts/en/checks/decide-conflict.md +1 -1
- package/prompts/en/checks/decide-opening.md +1 -1
- package/prompts/en/checks/decide-same-value.md +1 -1
- package/prompts/en/checks/decide-sheet.md +1 -1
- package/prompts/en/checks/decide-stated.md +1 -0
- package/prompts/en/checks/fidelity.md +1 -0
- package/prompts/zh/checks/conflict.md +1 -1
- package/prompts/zh/checks/decide-conflict.md +1 -1
- package/prompts/zh/checks/decide-opening.md +1 -1
- package/prompts/zh/checks/decide-same-value.md +1 -1
- package/prompts/zh/checks/decide-sheet.md +1 -1
- package/prompts/zh/checks/decide-stated.md +1 -0
- package/prompts/zh/checks/fidelity.md +1 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./narration-
|
|
3
|
-
import { J as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-CXtaZNbx.js";
|
|
2
|
+
import "./narration-B0hConSw.js";
|
|
3
|
+
import { J as Reader, Q as PROMPTS_FOLDER, X as errorMessage, Y as formatIssue, Z as LANGUAGE_FOLDER, at as shippedLanguages, it as promptProblem, nt as languageOf, ot as shippedPromptsDirectory, q as readDocument, rt as listFiles } from "./hooks-BuQ61nvQ.js";
|
|
4
|
+
import { i as translator, r as languageOf$1 } from "./text-CzqhC8sT.js";
|
|
5
|
+
import { u as parseSampling } from "./child-C8r8AFpm.js";
|
|
6
|
+
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
6
7
|
import { dirname, join } from "node:path";
|
|
7
8
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
8
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -1541,6 +1542,100 @@ function parseImportCommand(text) {
|
|
|
1541
1542
|
request: command.rest.slice(boundary).trim()
|
|
1542
1543
|
};
|
|
1543
1544
|
}
|
|
1545
|
+
// src/host/import/dialect.ts
|
|
1546
|
+
const MAX_NAMES = 8;
|
|
1547
|
+
const PLAIN_MACROS = /* @__PURE__ */ new Set([
|
|
1548
|
+
"user",
|
|
1549
|
+
"char",
|
|
1550
|
+
"bot"
|
|
1551
|
+
]);
|
|
1552
|
+
const MARKUP = /* @__PURE__ */ new Set([
|
|
1553
|
+
"a",
|
|
1554
|
+
"b",
|
|
1555
|
+
"i",
|
|
1556
|
+
"u",
|
|
1557
|
+
"s",
|
|
1558
|
+
"p",
|
|
1559
|
+
"br",
|
|
1560
|
+
"hr",
|
|
1561
|
+
"em",
|
|
1562
|
+
"strong",
|
|
1563
|
+
"span",
|
|
1564
|
+
"div",
|
|
1565
|
+
"code",
|
|
1566
|
+
"pre",
|
|
1567
|
+
"center",
|
|
1568
|
+
"small",
|
|
1569
|
+
"img",
|
|
1570
|
+
"ul",
|
|
1571
|
+
"ol",
|
|
1572
|
+
"li",
|
|
1573
|
+
"blockquote",
|
|
1574
|
+
"details",
|
|
1575
|
+
"summary",
|
|
1576
|
+
"font",
|
|
1577
|
+
"sub",
|
|
1578
|
+
"sup",
|
|
1579
|
+
"h1",
|
|
1580
|
+
"h2",
|
|
1581
|
+
"h3",
|
|
1582
|
+
"table",
|
|
1583
|
+
"tr",
|
|
1584
|
+
"td",
|
|
1585
|
+
"th"
|
|
1586
|
+
]);
|
|
1587
|
+
const MACRO = /\{\{\s*([\p{L}_][\p{L}\p{N}_]*)/gu;
|
|
1588
|
+
const BLOCK = /<([\p{L}][\p{L}\p{N}_-]{1,30})(?:\s[^>]*)?>[\s\S]*?<\/\1\s*>/gu;
|
|
1589
|
+
function textsOf(card) {
|
|
1590
|
+
return [
|
|
1591
|
+
card.description,
|
|
1592
|
+
card.personality,
|
|
1593
|
+
card.scenario,
|
|
1594
|
+
card.firstMessage,
|
|
1595
|
+
...card.alternateGreetings,
|
|
1596
|
+
card.messageExample,
|
|
1597
|
+
card.systemPrompt,
|
|
1598
|
+
card.postHistoryInstructions,
|
|
1599
|
+
...(card.book?.entries ?? []).map((entry) => entry.content)
|
|
1600
|
+
];
|
|
1601
|
+
}
|
|
1602
|
+
/** The distinct values of a pattern's first group over some texts, in the order met, lowercased and cut to a few. */
|
|
1603
|
+
function namesIn(texts, pattern, skip) {
|
|
1604
|
+
const found = /* @__PURE__ */ new Set();
|
|
1605
|
+
for (const text of texts) for (const match of text.matchAll(pattern)) {
|
|
1606
|
+
const name = match[1].toLowerCase();
|
|
1607
|
+
if (!skip(name)) found.add(name);
|
|
1608
|
+
}
|
|
1609
|
+
return [...found].slice(0, MAX_NAMES);
|
|
1610
|
+
}
|
|
1611
|
+
/** Reads the machinery of the source tool out of a card: macros, tag blocks and the scripts the reader counted. */
|
|
1612
|
+
function dialectOf(card) {
|
|
1613
|
+
const texts = textsOf(card);
|
|
1614
|
+
return {
|
|
1615
|
+
macros: namesIn(texts, MACRO, (name) => PLAIN_MACROS.has(name)),
|
|
1616
|
+
tags: namesIn(texts, BLOCK, (name) => MARKUP.has(name)),
|
|
1617
|
+
regexScripts: card.ignored.regexScripts ?? 0,
|
|
1618
|
+
helperScripts: card.ignored.helperScripts ?? card.ignored.scripts - (card.ignored.regexScripts ?? 0)
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
/** What the person is told about a card before the import starts: what it is, and which of its machinery is left out. */
|
|
1622
|
+
function sourceSummary(card, language) {
|
|
1623
|
+
const tr = translator(languageOf$1(language));
|
|
1624
|
+
const dialect = dialectOf(card);
|
|
1625
|
+
const lines = [tr("The source is a {format} card with {entries} lorebook entries and {greetings} alternate openings.", {
|
|
1626
|
+
format: card.sourceSpec === "chara_card_v2" ? "V2" : "V3",
|
|
1627
|
+
entries: String(card.book?.entries.length ?? 0),
|
|
1628
|
+
greetings: String(card.alternateGreetings.length)
|
|
1629
|
+
})];
|
|
1630
|
+
const left = [
|
|
1631
|
+
...dialect.regexScripts > 0 ? [tr("{count} regular expressions", { count: String(dialect.regexScripts) })] : [],
|
|
1632
|
+
...dialect.helperScripts > 0 ? [tr("{count} helper scripts", { count: String(dialect.helperScripts) })] : [],
|
|
1633
|
+
...dialect.macros.length > 0 ? [tr("macros ({names})", { names: dialect.macros.join(", ") })] : [],
|
|
1634
|
+
...dialect.tags.length > 0 ? [tr("tag blocks ({names})", { names: dialect.tags.join(", ") })] : []
|
|
1635
|
+
];
|
|
1636
|
+
if (left.length > 0) lines.push(tr("Nothing runs them, so they are not carried: {parts}. Their effect is kept only where the card also says it in words.", { parts: left.join("; ") }));
|
|
1637
|
+
return lines.join(" ");
|
|
1638
|
+
}
|
|
1544
1639
|
// src/host/import/store.ts
|
|
1545
1640
|
const IMPORT_FOLDER = ".import";
|
|
1546
1641
|
const CARD_FILE = "card.json";
|
|
@@ -1617,8 +1712,7 @@ async function readImportFolder(directory) {
|
|
|
1617
1712
|
}
|
|
1618
1713
|
async function writeChoices(directory, choices) {
|
|
1619
1714
|
const file = join(directory, CHOICES_FILE);
|
|
1620
|
-
await
|
|
1621
|
-
await rename(`${file}.writing`, file);
|
|
1715
|
+
await atomicWrite(file, JSON.stringify(choices, null, 2));
|
|
1622
1716
|
}
|
|
1623
1717
|
/** Uploaded cards waiting to become worlds: one folder each under `<root>/imports/`. */
|
|
1624
1718
|
var ImportStore = class {
|
|
@@ -1656,7 +1750,8 @@ var ImportStore = class {
|
|
|
1656
1750
|
id,
|
|
1657
1751
|
card,
|
|
1658
1752
|
choices,
|
|
1659
|
-
hasAvatar: hasPicture
|
|
1753
|
+
hasAvatar: hasPicture,
|
|
1754
|
+
dialect: dialectOf(card)
|
|
1660
1755
|
};
|
|
1661
1756
|
} catch (error) {
|
|
1662
1757
|
if (error.code === "ENOENT") throw new ImportNotFoundError(`there is no import "${id}"`);
|
|
@@ -4008,6 +4103,6 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
|
|
|
4008
4103
|
});
|
|
4009
4104
|
}
|
|
4010
4105
|
}
|
|
4011
|
-
export {
|
|
4106
|
+
export { IMPORT_FOLDER as $, sourcesFor as A, InvalidEditProblems as At, modeFor as B, DEFAULT_SLOTS as Bt, inert as C, parseSlotsFile as Ct, pruneLoreSubjects as D, parseCharacterFile as Dt, pruneLinks as E, CHARACTER_FILE_NAME as Et, ROLE_TABLE as F, parseRelationEdit as Ft, deleteWorldPrompt as G, routeVerdicts as H, isLeftOut as I, parseThingEdit as It, writeWorldPrompt as J, listWorldPrompts as K, announceProblem as L, LORE_KINDS as Lt, classifyItems as M, parseFactionEdit as Mt, findEntity as N, parseLoreEdit as Nt, pruneMembers as O, readVariableValues as Ot, ROLES as P, parsePlaceEdit as Pt, withPlayer as Q, askYesNo as R, LORE_SCOPES as Rt, extractVariables as S, parseItemFile as St, pruneKnowledge as T, parseFactionFile as Tt, yesAt as U, noAt as V, INTENT_STATUSES as Vt, PROSE_PROMPTS as W, itemise as X, cleanText as Y, partsOf as Z, characterDocument as _, parseLoreFile as _t, isPresetName as a, readImportFolder as at, extractStyle as b, ITEM_FILE_NAME as bt, presetDirectory as c, sourceSummary as ct, savePresetFromWorld as d, parseAuthoringCommand as dt, ImportNotFoundError as et, sha as f, VARIABLES_FILE_NAME as ft, asWritten as g, LORE_FILE_NAME as gt, addLore as h, variableProblems as ht, deletePreset as i, parseChoices as it, buildRoster as j, parseCharacterEdit as jt, pruneRelationships as k, readIdentifier as kt, readPreset as l, IMPORT_COMMAND as lt, STANDING_PROMPT as m, parseVariablesFile as mt, createPresetFromGuidance as n, PICTURE_FILE as nt, listPresets as o, writeChoices as ot, updatePresetInfo as p, loadVariables as pt, readWorldPrompt as q, createPresetFromShipped as r, openingText as rt, loadPreset as s, dialectOf as st, PRESET_FILE as t, ImportStore as tt, reservePreset as u, parseImportCommand as ut, emptyExtracted as v, LOCATION_FILE_NAME as vt, loreDocuments as w, FACTION_FILE_NAME as wt, extractStyleFrom as x, SLOTS_FILE_NAME as xt, extractEntities as y, parseLocationFile as yt, mergeReports as z, WEEKDAY_NAMES as zt };
|
|
4012
4107
|
|
|
4013
|
-
//# sourceMappingURL=presets-
|
|
4108
|
+
//# sourceMappingURL=presets-9_MNxwaw.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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
|
|
6
|
-
import { s as inheritImages } from "./library-
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
1
|
+
import { l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
+
import { H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, f as sha, o as listPresets, s as loadPreset, z as mergeReports } from "./presets-9_MNxwaw.js";
|
|
3
|
+
import { A as answerLimits, D as describeWhen, E as describeTime, Q as PROMPTS_FOLDER, R as wrongLanguage, tt as inheritPrompts } from "./hooks-BuQ61nvQ.js";
|
|
4
|
+
import { i as translator, r as languageOf, t as trimCharacters } from "./text-CzqhC8sT.js";
|
|
5
|
+
import { S as estimateAnswer, a as childTrace, c as runChild, n as childModel, r as childSampling } from "./child-C8r8AFpm.js";
|
|
6
|
+
import { s as inheritImages } from "./library-CH-ahlm0.js";
|
|
7
|
+
import { i as inheritPacks } from "./packs-B88bxt8E.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";
|
|
@@ -21,6 +21,89 @@ const MEMORY_CONFIDENCES = [
|
|
|
21
21
|
"likely",
|
|
22
22
|
"sure"
|
|
23
23
|
];
|
|
24
|
+
// src/shared/timeline.ts
|
|
25
|
+
const emptyTimeline = () => ({
|
|
26
|
+
version: 1,
|
|
27
|
+
head: null,
|
|
28
|
+
next: 1,
|
|
29
|
+
nodes: []
|
|
30
|
+
});
|
|
31
|
+
/** The turns from the first to `id`, in order; none for the start. */
|
|
32
|
+
function pathTo(timeline, id) {
|
|
33
|
+
const byId = new Map(timeline.nodes.map((node) => [node.id, node]));
|
|
34
|
+
const path = [];
|
|
35
|
+
for (let at = id === null ? void 0 : byId.get(id); at !== void 0; at = at.parent === null ? void 0 : byId.get(at.parent)) path.unshift(at);
|
|
36
|
+
return path;
|
|
37
|
+
}
|
|
38
|
+
/** The turns that follow `parent`, in the order they were played. */
|
|
39
|
+
const childrenOf = (timeline, parent) => timeline.nodes.filter((node) => node.parent === parent);
|
|
40
|
+
/** The snapshot that holds the state before any turn. */
|
|
41
|
+
const START_SNAPSHOT = "start";
|
|
42
|
+
/** The snapshot that holds the state after a turn. */
|
|
43
|
+
const snapshotOf = (id) => `after-${id}`;
|
|
44
|
+
/** Builds what the client shows from the timeline. */
|
|
45
|
+
function viewOf(timeline) {
|
|
46
|
+
const turn = (node) => ({
|
|
47
|
+
id: node.id,
|
|
48
|
+
turn: node.turn,
|
|
49
|
+
player: node.player,
|
|
50
|
+
...node.label === void 0 ? {} : { label: node.label },
|
|
51
|
+
...node.note === void 0 ? {} : { note: node.note },
|
|
52
|
+
...node.endSeq === void 0 ? {} : { endSeq: node.endSeq },
|
|
53
|
+
...node.output === void 0 ? {} : { output: node.output },
|
|
54
|
+
restorable: node.snapshot !== void 0,
|
|
55
|
+
alternatives: childrenOf(timeline, node.parent).map((sibling) => sibling.id)
|
|
56
|
+
});
|
|
57
|
+
const on = new Set(pathTo(timeline, timeline.head).map((node) => node.id));
|
|
58
|
+
const withdrawn = timeline.nodes.filter((node) => !on.has(node.id) && node.userSeq >= 0).map((node) => ({
|
|
59
|
+
from: Math.min(node.startSeq ?? node.userSeq, node.userSeq),
|
|
60
|
+
to: node.endSeq ?? Number.MAX_SAFE_INTEGER
|
|
61
|
+
}));
|
|
62
|
+
return {
|
|
63
|
+
head: timeline.head,
|
|
64
|
+
path: pathTo(timeline, timeline.head).map(turn),
|
|
65
|
+
forward: childrenOf(timeline, timeline.head).map(turn),
|
|
66
|
+
canStart: true,
|
|
67
|
+
withdrawn
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Where a notice stands for a turn that is not told by its own events: the player's words and what was delivered, as plain text. */
|
|
71
|
+
function noticeText(node) {
|
|
72
|
+
const told = node.output === void 0 ? "(nothing was delivered)" : node.output.segments.map((segment) => segment.type === "utterance" ? `${segment.name}: "${segment.text}"` : segment.text).join("\n");
|
|
73
|
+
const ooc = node.output?.ooc;
|
|
74
|
+
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}`;
|
|
75
|
+
return `The story, as it went earlier (restored):\nThe player said: ${node.player}${ruling}\nIt was told to the player:\n${told}`;
|
|
76
|
+
}
|
|
77
|
+
// src/host/timeline/file.ts
|
|
78
|
+
const TIMELINE_FILE = "timeline.json";
|
|
79
|
+
function isNode(value) {
|
|
80
|
+
if (typeof value !== "object" || value === null) return false;
|
|
81
|
+
const node = value;
|
|
82
|
+
return typeof node["id"] === "string" && (node["parent"] === null || typeof node["parent"] === "string") && typeof node["turn"] === "number" && typeof node["userSeq"] === "number" && typeof node["player"] === "string" && typeof node["createdAt"] === "string";
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The timeline of a session, or an empty one when it has none yet.
|
|
86
|
+
* @throws {Error} when the file is there and is not a timeline: it holds what lets the story be taken back, so it is not replaced silently.
|
|
87
|
+
*/
|
|
88
|
+
function readTimeline(folder) {
|
|
89
|
+
let text;
|
|
90
|
+
try {
|
|
91
|
+
text = readFileSync(join(folder, TIMELINE_FILE), "utf8");
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (error.code === "ENOENT") return emptyTimeline();
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
const value = JSON.parse(text);
|
|
97
|
+
if (value.version !== 1 || !Array.isArray(value.nodes) || !value.nodes.every(isNode) || typeof value.next !== "number" || value.head !== null && typeof value.head !== "string") throw new Error(`${join(folder, TIMELINE_FILE)} is not a timeline`);
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
/** Writes it aside and renames it, so a crash leaves the timeline as it was. */
|
|
101
|
+
function writeTimeline(folder, timeline) {
|
|
102
|
+
const target = join(folder, TIMELINE_FILE);
|
|
103
|
+
const aside = `${target}.writing`;
|
|
104
|
+
writeFileSync(aside, JSON.stringify(timeline, null, 2));
|
|
105
|
+
renameSync(aside, target);
|
|
106
|
+
}
|
|
24
107
|
// src/host/orchestration/referent.ts
|
|
25
108
|
/**
|
|
26
109
|
* 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.
|
|
@@ -400,7 +483,7 @@ function placedScene(cast, player, story, describeMember, tr, things) {
|
|
|
400
483
|
if (nowhere.length > 0) sections.push(`${tr("Characters with no place (not part of this scene; they cannot be asked to act):")}\n${nowhere.map(describeMember).join("\n")}`);
|
|
401
484
|
return sections.join("\n\n");
|
|
402
485
|
}
|
|
403
|
-
const castSummary = { scene({ tracked, time, world, cast, turn, input, queryVector, story, items, language: code }) {
|
|
486
|
+
const castSummary = { scene({ tracked, time, world, cast, turn, input, queryVector, story, items, language: code, report }) {
|
|
404
487
|
const language = languageOf(code);
|
|
405
488
|
const tr = translator(language);
|
|
406
489
|
const join = (entries) => entries.join(tr("; "));
|
|
@@ -414,26 +497,29 @@ const castSummary = { scene({ tracked, time, world, cast, turn, input, queryVect
|
|
|
414
497
|
const player = cast.find((member) => member.character.control === "player");
|
|
415
498
|
const days = time?.agenda === void 0 ? "" : describeSceneAgenda(time.agenda, time.now.now, tr, language);
|
|
416
499
|
const scene = cast.some((member) => member.place !== void 0) ? placedScene(cast, player, story, describeMember, tr, items) : cast.map(describeMember).join("\n");
|
|
417
|
-
const parts = [
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
500
|
+
const parts = [];
|
|
501
|
+
const add = (id, text) => {
|
|
502
|
+
parts.push(text);
|
|
503
|
+
report?.section(id, text);
|
|
504
|
+
};
|
|
505
|
+
if (time !== void 0) add("time", timeNotice(time, language, tr));
|
|
506
|
+
if (days !== "") add("agenda", days);
|
|
507
|
+
add("scene", `${tr("Scene before turn {turn}:", { turn })}\n${scene}`);
|
|
422
508
|
const activation = describeActivationCandidates(cast, input, story, tr);
|
|
423
|
-
if (activation !== "")
|
|
509
|
+
if (activation !== "") add("activation", activation);
|
|
424
510
|
if (items !== void 0) {
|
|
425
511
|
const carried = cast.flatMap((member) => {
|
|
426
512
|
const mine = items.carried(member.character.id);
|
|
427
513
|
return mine.length === 0 ? [] : [`- ${member.character.name} (${member.key}): ${describeItems(mine, { withKeys: true }, tr)}`];
|
|
428
514
|
});
|
|
429
|
-
if (carried.length > 0)
|
|
515
|
+
if (carried.length > 0) add("carried", `${tr("What characters have on them:")}\n${carried.join("\n")}`);
|
|
430
516
|
}
|
|
431
|
-
if (world !== void 0 && world.happened.length > 0)
|
|
432
|
-
if (world?.upcoming !== void 0 && world.upcoming.length > 0)
|
|
433
|
-
if (world !== void 0 && world.beats.length > 0)
|
|
434
|
-
if (tracked !== void 0 && tracked.length > 0)
|
|
517
|
+
if (world !== void 0 && world.happened.length > 0) add("world", `${tr("The world acted since the last turn, by itself:")}\n${world.happened.map((line) => `- ${line}`).join("\n")}`);
|
|
518
|
+
if (world?.upcoming !== void 0 && world.upcoming.length > 0) add("upcoming", `${tr("Known beforehand, still to come (who knows of it; it will happen by itself when its time comes):")}\n${world.upcoming.map((entry) => `- ${entry.text}${entry.when === void 0 ? "" : ` (${entry.when})`} ${tr("[known to {who}]", { who: entry.who })}`).join("\n")}`);
|
|
519
|
+
if (world !== void 0 && world.beats.length > 0) add("beats", `${tr("Weave these into the story when it fits, then say you did with addressed in narrate (each stays for a few turns and is then let go):")}\n${world.beats.map((beat) => `- [${beat.id}] ${beat.text}`).join("\n")}`);
|
|
520
|
+
if (tracked !== void 0 && tracked.length > 0) add("tracked", `${tr("What the story keeps track of (change it with variable_changes in an outcome when what happened calls for it):")}\n${tracked.map((line) => `- ${line}`).join("\n")}`);
|
|
435
521
|
const threads = story.threads.list("open");
|
|
436
|
-
if (threads.length > 0)
|
|
522
|
+
if (threads.length > 0) add("threads", `${tr("Still open in the story:")}\n${threads.map((thread) => `- ${thread.text}`).join("\n")}`);
|
|
437
523
|
const folded = story.summaries.list().reduce((latest, summary) => Math.max(latest, summary.toTurn), 0);
|
|
438
524
|
if (folded > 0) {
|
|
439
525
|
const mentionedIds = mentioned(input, cast.map(({ character }) => character));
|
|
@@ -443,18 +529,39 @@ const castSummary = { scene({ tracked, time, world, cast, turn, input, queryVect
|
|
|
443
529
|
text: input,
|
|
444
530
|
...queryVector === void 0 ? {} : { vector: queryVector },
|
|
445
531
|
toTurn: folded,
|
|
446
|
-
limit:
|
|
532
|
+
limit: 10
|
|
447
533
|
});
|
|
448
534
|
const byCues = story.events.list({ toTurn: folded }).filter((event) => !byMeaning.some((found) => found.id === event.id)).map((event) => ({
|
|
449
535
|
event,
|
|
450
536
|
score: 3 * event.involves.filter((id) => mentionedIds.has(id)).length + overlap(cues, event.text, event.tags)
|
|
451
537
|
})).filter(({ score }) => score >= 2).sort((a, b) => b.score + .5 * b.event.importance - a.score - .5 * a.event.importance || b.event.turn - a.event.turn).map(({ event }) => event);
|
|
452
|
-
const
|
|
453
|
-
|
|
538
|
+
const ranked = [...byMeaning.map((event) => ({
|
|
539
|
+
event,
|
|
540
|
+
how: "search"
|
|
541
|
+
})), ...byCues.map((event) => ({
|
|
542
|
+
event,
|
|
543
|
+
how: "cues"
|
|
544
|
+
}))];
|
|
545
|
+
const chosen = ranked.slice(0, REMINDED_EVENTS).sort((a, b) => a.event.turn - b.event.turn);
|
|
546
|
+
const relevant = chosen.map(({ event }) => ({ event }));
|
|
547
|
+
report?.selected({
|
|
548
|
+
events: chosen.map(({ event, how }) => ({
|
|
549
|
+
turn: event.turn,
|
|
550
|
+
text: event.text,
|
|
551
|
+
how
|
|
552
|
+
})),
|
|
553
|
+
omitted: ranked.length - chosen.length,
|
|
554
|
+
folded
|
|
555
|
+
});
|
|
556
|
+
if (relevant.length > 0) add("events", `${tr("Earlier events that bear on what the player just did (from the records of the story):")}\n${relevant.map(({ event }) => {
|
|
454
557
|
const who = event.involves.map((id) => names.get(id)).filter((name) => name !== void 0).join(tr(", "));
|
|
455
558
|
return `- (${tr("turn {turn}", { turn: event.turn })}) ${event.text}${who === "" ? "" : ` [${who}]`}`;
|
|
456
559
|
}).join("\n")}`);
|
|
457
|
-
}
|
|
560
|
+
} else report?.selected({
|
|
561
|
+
events: [],
|
|
562
|
+
omitted: 0,
|
|
563
|
+
folded: 0
|
|
564
|
+
});
|
|
458
565
|
return parts.join("\n\n");
|
|
459
566
|
} };
|
|
460
567
|
const sameCharacter = (utterance, character) => utterance.character === character || utterance.name === character;
|
|
@@ -533,14 +640,17 @@ const exactUtterances = {
|
|
|
533
640
|
}
|
|
534
641
|
};
|
|
535
642
|
/** What a character is reminded of is what the story's records bring back for it: by the cues of the moment, by its words, and by its meaning when vectors exist. */
|
|
536
|
-
const recordsRecall = { recall: ({ member, situation, turn, policy, queryVector, explain }, story, signal) => story.recallRanked({
|
|
643
|
+
const recordsRecall = { recall: ({ member, situation, turn, policy, queryVector, explain, peek }, story, signal) => story.recallRanked({
|
|
537
644
|
characterId: member.character.id,
|
|
538
645
|
situation,
|
|
539
646
|
turn,
|
|
540
647
|
policy,
|
|
541
648
|
...explain === true ? { explain } : {},
|
|
542
649
|
...member.place === void 0 ? {} : { locationId: member.place.location.id }
|
|
543
|
-
}, signal,
|
|
650
|
+
}, signal, {
|
|
651
|
+
...queryVector === void 0 ? {} : { queryVector },
|
|
652
|
+
...peek === true ? { peek } : {}
|
|
653
|
+
}) };
|
|
544
654
|
/**
|
|
545
655
|
* Writes no memory. What the game master decided about each character is applied when the round is
|
|
546
656
|
* recorded, so without a memory keeper the story keeps its states and no events.
|
|
@@ -711,87 +821,6 @@ function inheritPreset(from, to) {
|
|
|
711
821
|
const file = join(from, PRESET_RECORD);
|
|
712
822
|
if (existsSync(file)) copyFileSync(file, join(to, PRESET_RECORD));
|
|
713
823
|
}
|
|
714
|
-
// src/shared/timeline.ts
|
|
715
|
-
const emptyTimeline = () => ({
|
|
716
|
-
version: 1,
|
|
717
|
-
head: null,
|
|
718
|
-
next: 1,
|
|
719
|
-
nodes: []
|
|
720
|
-
});
|
|
721
|
-
/** The turns from the first to `id`, in order; none for the start. */
|
|
722
|
-
function pathTo(timeline, id) {
|
|
723
|
-
const byId = new Map(timeline.nodes.map((node) => [node.id, node]));
|
|
724
|
-
const path = [];
|
|
725
|
-
for (let at = id === null ? void 0 : byId.get(id); at !== void 0; at = at.parent === null ? void 0 : byId.get(at.parent)) path.unshift(at);
|
|
726
|
-
return path;
|
|
727
|
-
}
|
|
728
|
-
/** The turns that follow `parent`, in the order they were played. */
|
|
729
|
-
const childrenOf = (timeline, parent) => timeline.nodes.filter((node) => node.parent === parent);
|
|
730
|
-
/** The snapshot that holds the state before any turn. */
|
|
731
|
-
const START_SNAPSHOT = "start";
|
|
732
|
-
/** The snapshot that holds the state after a turn. */
|
|
733
|
-
const snapshotOf = (id) => `after-${id}`;
|
|
734
|
-
/** Builds what the client shows from the timeline. */
|
|
735
|
-
function viewOf(timeline) {
|
|
736
|
-
const turn = (node) => ({
|
|
737
|
-
id: node.id,
|
|
738
|
-
turn: node.turn,
|
|
739
|
-
player: node.player,
|
|
740
|
-
...node.endSeq === void 0 ? {} : { endSeq: node.endSeq },
|
|
741
|
-
...node.output === void 0 ? {} : { output: node.output },
|
|
742
|
-
restorable: node.snapshot !== void 0,
|
|
743
|
-
alternatives: childrenOf(timeline, node.parent).map((sibling) => sibling.id)
|
|
744
|
-
});
|
|
745
|
-
const on = new Set(pathTo(timeline, timeline.head).map((node) => node.id));
|
|
746
|
-
const withdrawn = timeline.nodes.filter((node) => !on.has(node.id) && node.userSeq >= 0).map((node) => ({
|
|
747
|
-
from: Math.min(node.startSeq ?? node.userSeq, node.userSeq),
|
|
748
|
-
to: node.endSeq ?? Number.MAX_SAFE_INTEGER
|
|
749
|
-
}));
|
|
750
|
-
return {
|
|
751
|
-
head: timeline.head,
|
|
752
|
-
path: pathTo(timeline, timeline.head).map(turn),
|
|
753
|
-
forward: childrenOf(timeline, timeline.head).map(turn),
|
|
754
|
-
canStart: true,
|
|
755
|
-
withdrawn
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
/** Where a notice stands for a turn that is not told by its own events: the player's words and what was delivered, as plain text. */
|
|
759
|
-
function noticeText(node) {
|
|
760
|
-
const told = node.output === void 0 ? "(nothing was delivered)" : node.output.segments.map((segment) => segment.type === "utterance" ? `${segment.name}: "${segment.text}"` : segment.text).join("\n");
|
|
761
|
-
const ooc = node.output?.ooc;
|
|
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}`;
|
|
763
|
-
return `The story, as it went earlier (restored):\nThe player said: ${node.player}${ruling}\nIt was told to the player:\n${told}`;
|
|
764
|
-
}
|
|
765
|
-
// src/host/timeline/file.ts
|
|
766
|
-
const TIMELINE_FILE = "timeline.json";
|
|
767
|
-
function isNode(value) {
|
|
768
|
-
if (typeof value !== "object" || value === null) return false;
|
|
769
|
-
const node = value;
|
|
770
|
-
return typeof node["id"] === "string" && (node["parent"] === null || typeof node["parent"] === "string") && typeof node["turn"] === "number" && typeof node["userSeq"] === "number" && typeof node["player"] === "string" && typeof node["createdAt"] === "string";
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* The timeline of a session, or an empty one when it has none yet.
|
|
774
|
-
* @throws {Error} when the file is there and is not a timeline: it holds what lets the story be taken back, so it is not replaced silently.
|
|
775
|
-
*/
|
|
776
|
-
function readTimeline(folder) {
|
|
777
|
-
let text;
|
|
778
|
-
try {
|
|
779
|
-
text = readFileSync(join(folder, TIMELINE_FILE), "utf8");
|
|
780
|
-
} catch (error) {
|
|
781
|
-
if (error.code === "ENOENT") return emptyTimeline();
|
|
782
|
-
throw error;
|
|
783
|
-
}
|
|
784
|
-
const value = JSON.parse(text);
|
|
785
|
-
if (value.version !== 1 || !Array.isArray(value.nodes) || !value.nodes.every(isNode) || typeof value.next !== "number" || value.head !== null && typeof value.head !== "string") throw new Error(`${join(folder, TIMELINE_FILE)} is not a timeline`);
|
|
786
|
-
return value;
|
|
787
|
-
}
|
|
788
|
-
/** Writes it aside and renames it, so a crash leaves the timeline as it was. */
|
|
789
|
-
function writeTimeline(folder, timeline) {
|
|
790
|
-
const target = join(folder, TIMELINE_FILE);
|
|
791
|
-
const aside = `${target}.writing`;
|
|
792
|
-
writeFileSync(aside, JSON.stringify(timeline, null, 2));
|
|
793
|
-
renameSync(aside, target);
|
|
794
|
-
}
|
|
795
824
|
// src/host/timeline/branch.ts
|
|
796
825
|
var BranchError = class extends Error {};
|
|
797
826
|
/**
|
|
@@ -995,8 +1024,8 @@ var Timelines = class {
|
|
|
995
1024
|
writeTimeline(this.folder(id), timeline);
|
|
996
1025
|
}
|
|
997
1026
|
/** Keeps the state as it is under the name of the turn it follows from, when that is not done yet. */
|
|
998
|
-
keep(id, timeline, at) {
|
|
999
|
-
if (this.deps.keepSnapshots(id) === 0) return;
|
|
1027
|
+
keep(id, timeline, at, force = false) {
|
|
1028
|
+
if (!force && this.deps.keepSnapshots(id) === 0) return;
|
|
1000
1029
|
const node = at === null ? void 0 : timeline.nodes.find((candidate) => candidate.id === at);
|
|
1001
1030
|
const name = node === void 0 ? START_SNAPSHOT : snapshotOf(node.id);
|
|
1002
1031
|
if (node !== void 0 && node.snapshot !== void 0) return;
|
|
@@ -1007,10 +1036,48 @@ var Timelines = class {
|
|
|
1007
1036
|
writeTimeline(this.folder(id), timeline);
|
|
1008
1037
|
}
|
|
1009
1038
|
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Names a turn as a checkpoint, with a note: its state is kept (taken now when the story stands there and has not kept it) and no longer pruned.
|
|
1041
|
+
* @throws {TimelineError} when there is no such turn, the name is empty or too long, or the turn's state is gone.
|
|
1042
|
+
*/
|
|
1043
|
+
mark(chat, target, label, note) {
|
|
1044
|
+
return this.serial(chat, async () => {
|
|
1045
|
+
const id = this.idOf(chat);
|
|
1046
|
+
const name = label.trim();
|
|
1047
|
+
if (name === "" || name.length > 80) throw new TimelineError(`a checkpoint's name is 1 to 80 characters`);
|
|
1048
|
+
if (note !== void 0 && note.length > 500) throw new TimelineError(`a checkpoint's note is at most 500 characters`);
|
|
1049
|
+
const timeline = this.read(id);
|
|
1050
|
+
const node = timeline.nodes.find((candidate) => candidate.id === target);
|
|
1051
|
+
if (node === void 0) throw new TimelineError(`there is no turn "${target}"`);
|
|
1052
|
+
if (node.snapshot === void 0 && timeline.head === node.id) {
|
|
1053
|
+
await this.deps.engine.quiesce(chat);
|
|
1054
|
+
this.keep(id, timeline, node.id, true);
|
|
1055
|
+
}
|
|
1056
|
+
if (node.snapshot === void 0) throw new TimelineError("the state of the story at that turn was not kept, so it cannot be a checkpoint");
|
|
1057
|
+
node.label = name;
|
|
1058
|
+
if (note === void 0 || note.trim() === "") delete node.note;
|
|
1059
|
+
else node.note = note.trim();
|
|
1060
|
+
writeTimeline(this.folder(id), timeline);
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
/** Takes the name off a turn; its state is kept or let go like any other turn's. */
|
|
1064
|
+
unmark(chat, target) {
|
|
1065
|
+
return this.serial(chat, () => {
|
|
1066
|
+
const id = this.idOf(chat);
|
|
1067
|
+
const timeline = this.read(id);
|
|
1068
|
+
const node = timeline.nodes.find((candidate) => candidate.id === target);
|
|
1069
|
+
if (node === void 0) throw new TimelineError(`there is no turn "${target}"`);
|
|
1070
|
+
delete node.label;
|
|
1071
|
+
delete node.note;
|
|
1072
|
+
writeTimeline(this.folder(id), timeline);
|
|
1073
|
+
this.prune(id, timeline);
|
|
1074
|
+
return Promise.resolve();
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1010
1077
|
/** Lets the oldest snapshots go: only the turns most recently played keep theirs, and the one that holds the start stays. */
|
|
1011
1078
|
prune(id, timeline) {
|
|
1012
1079
|
const keep = this.deps.keepSnapshots(id);
|
|
1013
|
-
const kept = timeline.nodes.filter((node) => node.snapshot !== void 0);
|
|
1080
|
+
const kept = timeline.nodes.filter((node) => node.snapshot !== void 0 && node.label === void 0);
|
|
1014
1081
|
const dropped = kept.slice(0, Math.max(0, kept.length - keep));
|
|
1015
1082
|
if (dropped.length === 0) return;
|
|
1016
1083
|
for (const node of dropped) {
|
|
@@ -2026,6 +2093,6 @@ function memoryReflector(deps) {
|
|
|
2026
2093
|
return { characters };
|
|
2027
2094
|
} };
|
|
2028
2095
|
}
|
|
2029
|
-
export {
|
|
2096
|
+
export { START_SNAPSHOT as _, whereabouts as a, snapshotOf as b, copyPreset as c, switchPreset as d, defaultBoundaries as f, writeTimeline as g, readTimeline as h, reflectionStatus as i, presetStatus as l, referent as m, memoryReflector as n, TimelineError as o, sameWords as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u, childrenOf as v, pathTo as y };
|
|
2030
2097
|
|
|
2031
|
-
//# sourceMappingURL=reflection-
|
|
2098
|
+
//# sourceMappingURL=reflection-BvM0w1R4.js.map
|
|
@@ -215,6 +215,16 @@ const ZH = {
|
|
|
215
215
|
"## MCP resource servers\n\nUse {tools} with the server argument naming an MCP server.": "## MCP 资源服务器\n\n使用 {tools},server 参数填 MCP 服务器的名称。",
|
|
216
216
|
"## MCP resource servers\n\nUse {tools} with one of these names as the server argument: {servers}.": "## MCP 资源服务器\n\n使用 {tools},server 参数填下列名称之一:{servers}。",
|
|
217
217
|
"{where}: the text is longer than {max} characters. A belief is not rewritten to hold what speaks against it: leave the text out and list the belief under doubt with the numbers of what speaks against it, and put what was learned as a new belief of its own": "{where}:文字超过 {max} 个字符。不要通过改写信念来容纳与之相悖的事:不要写文字,把这条信念列入 doubt 并给出与之相悖的编号;新了解到的内容另写成一条新信念",
|
|
218
|
+
"The source is a {format} card with {entries} lorebook entries and {greetings} alternate openings.": "来源是一张 {format} 角色卡,含 {entries} 条世界书条目和 {greetings} 个备选开场。",
|
|
219
|
+
"{count} regular expressions": "{count} 条正则表达式",
|
|
220
|
+
"{count} helper scripts": "{count} 个辅助脚本",
|
|
221
|
+
"macros ({names})": "宏({names})",
|
|
222
|
+
"tag blocks ({names})": "标签块({names})",
|
|
223
|
+
"Nothing runs them, so they are not carried: {parts}. Their effect is kept only where the card also says it in words.": "这些内容不会被执行,所以不会带入:{parts}。只有卡片同时用文字写明的效果才会保留。",
|
|
224
|
+
"this chat follows the clock on the wall, so time cannot be skipped": "这个对话跟随墙上的时钟,所以不能跳过时间",
|
|
225
|
+
"say how long, for example /wait 2 hours or /wait 30 minutes until the ferry": "请说明要等多久,例如 /wait 2 hours,或 /wait 30 minutes until the ferry",
|
|
226
|
+
"that is more than the {days} days this chat allows in one skip": "这超过了本对话一次最多可跳过的 {days} 天",
|
|
227
|
+
"The player lets {minutes} minutes pass{reason}. Move the story's time on by that much with advance_time, and let the world move meanwhile as it would: characters keep to their days, and you ask only those the time reaches. Stop sooner, at the moment it happens, if something comes up that the player must decide or could not sleep through, say what, and let the player act. Then narrate what the player perceived in the time that passed. You may play at most {rounds} rounds for this.": "玩家让 {minutes} 分钟过去{reason}。用 advance_time 把故事时间推进这么久,期间让世界照常运转:角色按各自的日程行事,你只询问时间涉及到的那些人。如果出现了玩家必须决定、或睡不过去的事,就在它发生的那一刻提前停下,说明是什么,让玩家行动。然后叙述玩家在这段时间里感知到的内容。为此你最多可以进行 {rounds} 轮。",
|
|
218
228
|
"Import this card into this newly created world.": "把这张卡片导入这个新建的世界。",
|
|
219
229
|
"The character card this world was made from has a newer version, kept in this world's .import/update folder. Bring the world up to date with it. First call card_diff: it lists what changed between the two versions, which characters, places and things were made from each changed piece, and which files of the world have been edited since the import. Read the pieces you need with card_read (version current is the old card, version new is the new one). Then change only what the new card changed, with your editing tools, and keep what the person has edited since the import. What the card says about the world itself (its description, tags and opening) is changed with edit_world_info. Remove what only a dropped piece made unless the person edited it. Do not add what neither version of the card says. When the world matches the new card, call check_card with version new: it lists what the new card changed that the world does not say yet; deal with each finding or say why you left it. Then call card_update_finish, and tell me briefly what you changed, what you left alone and why.": "这个世界所依据的角色卡有了新版本,放在这个世界的 .import/update 文件夹里。请让世界与它保持一致。先调用 card_diff:它会列出两个版本之间的变化、每个变化的片段生成了哪些角色、地点和物品,以及导入之后世界里哪些文件被修改过。需要时用 card_read 读取片段(version 为 current 是旧卡,为 new 是新卡)。然后用你的编辑工具只改新卡改动的部分,并保留用户在导入之后做的修改。卡片对世界本身的描述(简介、标签和开场)用 edit_world_info 修改。只由已被删除的片段生成、且用户没有改过的内容,要移除。两个版本的卡都没有写的内容,一概不要添加。世界与新卡一致后,调用 check_card 并设 version 为 new:它会列出新卡改动了、而世界里还没有写到的内容;逐条处理,或说明为什么不处理。然后调用 card_update_finish,再简要告诉我:你改了什么、哪些没动以及原因。",
|
|
220
230
|
"The update from the newer card is not finished. Apply the changes that remain and call card_update_finish. A change you cannot make with your tools, or one you need the person to decide, goes in your report instead; then say what is left.": "按新卡更新还没有完成。请应用剩下的改动,然后调用 card_update_finish。你的工具做不了的改动,或需要用户决定的改动,写进报告里;然后说明还剩什么。",
|
|
@@ -301,4 +311,4 @@ function withoutExtension(value) {
|
|
|
301
311
|
}
|
|
302
312
|
export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
|
|
303
313
|
|
|
304
|
-
//# sourceMappingURL=text-
|
|
314
|
+
//# sourceMappingURL=text-CzqhC8sT.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as guardRepeatedCalls } from "./hooks-
|
|
1
|
+
import { b as cutOff, x as finishOf } from "./child-C8r8AFpm.js";
|
|
2
|
+
import { d as guardRepeatedCalls } from "./hooks-BuQ61nvQ.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-Ygdww1Wt.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.10.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.10.1",
|
|
80
80
|
"@dsh-ai-providers/core": "^0.5.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Two background entries of a story world are given. Find whether they say things that cannot both be true at the same time (different dates for one event, different causes, a person alive in one and dead in the other, a place in two incompatible spots). Details that only add to each other, statements about different times, and the differing beliefs of different people are not conflicts. If they conflict, answer conflict true and quote, exactly as written, the passage of the first entry and the passage of the second that rule each other out, and say in a sentence why. If not, answer conflict false with empty quotes. Never conclude a conflict you cannot quote. A title or heading is not a statement, and two entries with similar titles are not in conflict for that reason; quote the clauses that disagree.
|
|
1
|
+
Two background entries of a story world are given. Find whether they say things that cannot both be true at the same time (different dates for one event, different causes, a person alive in one and dead in the other, a place in two incompatible spots). Details that only add to each other, statements about different times, and the differing beliefs of different people are not conflicts. If they conflict, answer conflict true and quote, exactly as written, the passage of the first entry and the passage of the second that rule each other out, and say in a sentence why. If not, answer conflict false with empty quotes. Never conclude a conflict you cannot quote. A title or heading is not a statement, and two entries with similar titles are not in conflict for that reason; quote the clauses that disagree. The two statements must be about the same thing (the same event, person, place or object) and give it incompatible facts; if you need an assumption beyond the two texts to make them clash, or the clash holds only if one word is read in a strained way, it is not a conflict.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Two background entries of a story world are given below. Do they say things that cannot both be true at the same time: two different dates for one event, two different causes, a person alive in one and dead in the other, a place in two incompatible spots? They do not conflict when one only adds detail to the other, when they speak of different times, or when they are two people's differing beliefs. Answer yes only when you can point to a statement in each that rules out the other, and give the reason in a sentence.
|
|
1
|
+
Two background entries of a story world are given below. Do they say things that cannot both be true at the same time: two different dates for one event, two different causes, a person alive in one and dead in the other, a place in two incompatible spots? They do not conflict when one only adds detail to the other, when they speak of different times, or when they are two people's differing beliefs. Answer yes only when you can point to a statement in each that rules out the other, and give the reason in a sentence. The two statements must be about the same thing; if an assumption beyond the two texts is needed to make them clash, they do not conflict.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
A person is about to start a story as the character described below. Read the opening and the first scene: where the character is, who and what is there, what the character is doing or wants. Is it enough for the person to know where they are and to have something to do, a person to talk to, a problem to face or a want to follow, for the first move? It is not enough when the opening is missing or only sets a mood, when nothing in the place invites action, or when it is unclear who the player is. Answer yes when it is enough, and give the reason in a sentence.
|
|
1
|
+
A person is about to start a story as the character described below. Read the opening and the first scene: where the character is, who and what is there, what the character is doing or wants. Is it enough for the person to know where they are and to have something to do, a person to talk to, a problem to face or a want to follow, for the first move? It is not enough when the opening is missing or only sets a mood, when nothing in the place invites action, or when it is unclear who the player is. Being able to walk somewhere else (a way out) is not something to do. Answer yes when it is enough, and give the reason in a sentence.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Two values a story keeps track of are described below, each with its name, key and what it means. Do they measure the same thing, so that keeping both would record one fact twice and let the two drift apart? They do when one is another name, abbreviation or translation of the other (health and hit points, gold and coins). They do not when they are related but different (health and stamina, trust and affection, hunger and thirst), or measure the same thing for different subjects. Answer yes when they are the same value, and give the reason in a sentence.
|
|
1
|
+
Two values a story keeps track of are described below, each with its name, key and what it means. Do they measure the same thing, so that keeping both would record one fact twice and let the two drift apart? They do when one is another name, abbreviation or translation of the other (health and hit points, gold and coins). They do not when they are related but different (health and stamina, trust and affection, hunger and thirst), or measure the same thing for different subjects, or when one is a kind, a cause or an effect of the other (sweat and wetness, a wound and blood loss): one could not stand in for the other without losing something. Answer yes when they are the same value, and give the reason in a sentence.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Is this character sheet enough to play the character convincingly? It is enough when it tells who the character is, how they talk or carry themselves, and
|
|
1
|
+
Is this character sheet enough to play the character convincingly? It is enough when it tells who the character is, how they talk or carry themselves, and at least one thing they want, fear or care about, so that someone who has read nothing else could answer in their voice and decide what they do. It is not enough when it is only a name and a line, or only a list of looks. A sheet is not thin because it could say more: one clear want, fear or concern is enough. Answer yes when it is enough, and give the reason in a sentence.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
A fact and a text are given, and sometimes the subject the text is about. Does the text state the fact, in any wording or language? Judge the fact as it is given: a fact that holds a cause, a number or a name that the text leaves out is not stated, even when the rest of it is. A text that only mentions the same person or place without stating the fact does not either. When a subject is given and the fact is about someone or something else, it is not the text's to state: answer yes. Answer yes when the text says it, and give the reason in a sentence.
|
|
@@ -5,3 +5,4 @@ You compare one document of a role-playing world with the pieces of the characte
|
|
|
5
5
|
- Judge by meaning, not by wording: a fact said in other words, or in another language, is kept. Style, order and length are not facts. Do not report what the document leaves out on purpose (instructions to the narrator, text addressed to the player).
|
|
6
6
|
- Report only what you are sure of, at most six of each. Report nothing when the document keeps the facts and adds none.
|
|
7
7
|
- Do not report what follows plainly from the source (a pronoun from a title, a role label, an entry's kind or layout), and give each passage once, with all the facts it holds in one entry.
|
|
8
|
+
- Go through the source one sentence at a time and check each fact in it against the document before you answer; a cause, a number or a name that the document leaves out is dropped even when the rest of the sentence is kept.
|