@dsh-agentic-roleplay/core 0.6.1 → 0.7.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.
Files changed (40) hide show
  1. package/lib/access-DtOxFKBK.js +150 -0
  2. package/lib/{authoring-tools-BGzzW6O5.js → authoring-tools-BKltdiea.js} +160 -74
  3. package/lib/authoring.js +10 -5
  4. package/lib/{child-D5SVNk4O.js → child-CyCViUKa.js} +48 -7
  5. package/lib/client.js +2157 -780
  6. package/lib/client.js.map +1 -1
  7. package/lib/compaction.js +3 -3
  8. package/lib/doctor.js +3 -3
  9. package/lib/{gallery-C7VOJ3xH.js → gallery-BxZGOgMb.js} +2 -2
  10. package/lib/{generator-CO8usAjE.js → generator-BFmSYvR8.js} +2 -2
  11. package/lib/helper.js +1 -1
  12. package/lib/{hooks-BLperIIB.js → hooks-HnqXO8mM.js} +10 -241
  13. package/lib/images.js +4 -4
  14. package/lib/index.js +1424 -203
  15. package/lib/{library-DsDc6fQa.js → library-BGxPKs9a.js} +6 -3
  16. package/lib/{lorebook-author-tools-C-cFiE6E.js → lorebook-author-tools-BAnUyRtS.js} +37 -29
  17. package/lib/lorebook-authoring.js +8 -3
  18. package/lib/{narration-_dA9oIt2.js → narration-DvFBqmqe.js} +9 -132
  19. package/lib/orchestration.js +13 -10
  20. package/lib/{pack-jail-BKFmbYP8.js → pack-jail-DLGguGS3.js} +20 -13
  21. package/lib/{packs-ZTG7fWut.js → packs-jowC-MN_.js} +2 -2
  22. package/lib/{presenter-agent-BHSbyWwZ.js → presenter-agent-DvZtnf0Q.js} +6 -6
  23. package/lib/{preset-CJLW8Mp0.js → preset-CXbC0NeU.js} +3 -3
  24. package/lib/{preset-author-tools-1RstgEZs.js → preset-author-tools-C26kj6t5.js} +14 -7
  25. package/lib/preset-authoring.js +9 -4
  26. package/lib/{reflection-6qfOC5OT.js → reflection-CvOZGjmn.js} +9 -170
  27. package/lib/{presets-DcPCnn8O.js → route-DRTJ_vcA.js} +165 -4
  28. package/lib/text-JbWfTHbr.js +295 -0
  29. package/lib/turn-guard-BvCs1VxB.js +53 -0
  30. package/package.json +29 -29
  31. package/prompts/en/import/cut-off.md +1 -0
  32. package/prompts/en/import/finish-failed.md +1 -1
  33. package/prompts/en/roleplay/decide-instruction.md +1 -0
  34. package/prompts/en/roleplay/decide-irrelevant.md +1 -0
  35. package/prompts/zh/import/cut-off.md +1 -0
  36. package/prompts/zh/import/finish-failed.md +1 -1
  37. package/prompts/zh/roleplay/decide-instruction.md +1 -0
  38. package/prompts/zh/roleplay/decide-irrelevant.md +1 -0
  39. package/lib/access-EbNdZFbk.js +0 -25
  40. package/lib/text-CT1re6XT.js +0 -18
@@ -0,0 +1,295 @@
1
+ //#region ../dsh-roleplay-model/src/messages-zh.ts
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
+ const ZH = {
4
+ ", ": ",",
5
+ "; ": ";",
6
+ ": ": ":",
7
+ ".": "。",
8
+ " and ": "和",
9
+ "doubtful": "存疑",
10
+ "likely": "较有把握",
11
+ "sure": "确信",
12
+ "open": "畅通",
13
+ "locked": "已上锁",
14
+ "blocked": "被堵住",
15
+ "night": "夜里",
16
+ "morning": "上午",
17
+ "afternoon": "下午",
18
+ "evening": "傍晚",
19
+ "spring": "春季",
20
+ "summer": "夏季",
21
+ "autumn": "秋季",
22
+ "winter": "冬季",
23
+ "today is {holidays}": "今天是{holidays}",
24
+ "Summary": "概述",
25
+ "Personality": "性格",
26
+ "Background": "背景",
27
+ "Appearance": "外貌",
28
+ "How you speak": "说话方式",
29
+ "Talk to {name}.": "和{name}聊聊。",
30
+ "Go to {place}.": "前往{place}。",
31
+ "Take a closer look at {thing}.": "仔细看看{thing}。",
32
+ "Look around carefully.": "仔细观察四周。",
33
+ "Wait and see what happens.": "先等等,看看会发生什么。",
34
+ "Ask what is going on.": "问问这是怎么回事。",
35
+ "Think about what to do next.": "想想接下来该怎么办。",
36
+ "You are {name}.": "你是{name}。",
37
+ "You are also called {names}.": "你也被称作{names}。",
38
+ "age: {value}": "年龄:{value}",
39
+ "gender: {value}": "性别:{value}",
40
+ "pronouns: {value}": "代词:{value}",
41
+ "- {key} ({name}): {use}": "- {key}({name}):{use}",
42
+ "Rolls {dice}.": "掷 {dice}。",
43
+ "Give a target: the difficulty, the number to meet or beat; set it by how hard the attempt is.": "需给出 target:难度,即要达到或超过的数字;按这次尝试的难易来定。",
44
+ "Give a target: the number to stay under; set it by how hard the attempt is.": "需给出 target:要低于的数字;按这次尝试的难易来定。",
45
+ "It adds the character's {variable}.": "它会加上该角色的 {variable}。",
46
+ "Counts the dice that show {hit} or more.": "统计显示 {hit} 或更高的骰子数。",
47
+ "the player's roll": "玩家的掷骰",
48
+ "The player rolled {dice} ({reason}) and got {total}: dice {faces}. This is a fact, decided by the dice: take it into account when you judge the attempt and decide what happens.": "玩家掷了 {dice}({reason}),得到 {total}:骰面 {faces}。这是由骰子决定的事实:在你判断这次尝试、决定发生什么时把它考虑进去。",
49
+ "The checks of this story:": "本故事的检定:",
50
+ "No checks are defined: use roll_dice only.": "没有定义检定:只用 roll_dice。",
51
+ "Situation:": "当前情形:",
52
+ "Now: {time}.": "现在是:{time}。",
53
+ "Where you are:": "你所在之处:",
54
+ "Present:": "在场的人:",
55
+ " (you)": "(你)",
56
+ "What you know is coming:": "你知道即将发生的事:",
57
+ "Just now you notice:": "此刻你注意到:",
58
+ "How you are (what you can tell of yourself):": "你的状态(你自己能感觉到的):",
59
+ "What you can tell of the others here:": "你能看出在场其他人的情况:",
60
+ "What you have on you:": "你身上带着:",
61
+ "Things here: ": "这里有:",
62
+ "Ways out: ": "出路:",
63
+ "Lying about: ": "散落在周围的:",
64
+ "hidden": "隐蔽",
65
+ " holding {things}": ",里面有{things}",
66
+ "; and {count} more": ";另有{count}项",
67
+ "at {feature}": "在{feature}",
68
+ "; and {count} more you can recall if needed": ";另有{count}项,需要时你可以回想起来",
69
+ "What you know exists (this does not tell you where it is now or what state it is in):": "你知道存在的事物(这并不说明它现在在哪里、处于什么状态):",
70
+ "People: ": "人物:",
71
+ "Factions: ": "组织:",
72
+ "Places: ": "地点:",
73
+ "Routes: ": "路径:",
74
+ "Things: ": "物品:",
75
+ "Background you know, to read with recall_my_lore when it bears on the moment: ": "你所知的背景(与当下相关时用 recall_my_lore 查阅):",
76
+ "Your day and what you are after (plans, not orders: keep them, put them off or drop them as the moment and your character suggest):": "你的日程与你想达成的事(只是计划,不是命令:依当下情形和你的性格,可以照做、推迟或放弃):",
77
+ "Your day, now: {activity}{place}, until {until}{note}.": "你此刻的日程:{activity}{place},持续到{until}{note}。",
78
+ "Your day, next: {activity}{place}, from {from}.": "你接下来的日程:{activity}{place},{from}开始。",
79
+ " at {place}": ",在{place}",
80
+ " (not something you would drop lightly)": "(你不会轻易放下)",
81
+ ", with {names}": ",与{names}一起",
82
+ "You were to: {title}{place}{with}, at {at}, which has passed and is still open.": "你本应:{title}{place}{with},时间是{at},已经过了,事情仍未了结。",
83
+ "You are due to: {title}{place}{with}, at {at}.": "你约定要:{title}{place}{with},时间是{at}。",
84
+ "What you are after:": "你想达成的事:",
85
+ ", by {deadline}, which has passed": ",限期{deadline},已过",
86
+ ", by {deadline}": ",限期{deadline}",
87
+ " Next: {plan}.": " 下一步:{plan}。",
88
+ "How you stand with people who bear on this moment (your own view, not objective fact):": "你与和此刻相关的人的关系(是你自己的看法,不是客观事实):",
89
+ " (here)": "(在场)",
90
+ " (not here)": "(不在场)",
91
+ "knows them well": "很了解对方",
92
+ "barely knows them": "几乎不了解对方",
93
+ "trusts them": "信任对方",
94
+ "distrusts them": "不信任对方",
95
+ "is fond of them": "喜欢对方",
96
+ "dislikes them": "不喜欢对方",
97
+ "things are strained between them": "彼此关系紧张",
98
+ "Your affiliations (their goals are pressures and commitments, not commands):": "你的所属组织(其目标是压力和承诺,不是命令):",
99
+ "member": "成员",
100
+ " Goals: {goals}.": " 目标:{goals}。",
101
+ "- {name}: {position}; {status}; commitment {commitment}.": "- {name}:{position};{status};投入程度 {commitment}。",
102
+ " Your view: {attitude}.": " 你的看法:{attitude}。",
103
+ "What you remember that bears on this (only what you took in yourself; do not claim to remember more, and be unsure of what is fuzzy):": "你记得的、与此相关的事(只限你自己亲身经历的;不要声称记得更多,模糊的地方要保持不确定):",
104
+ "What you remember that bears on this: nothing comes to mind.": "你记得的、与此相关的事:想不起任何事。",
105
+ "some time ago": "一段时间以前",
106
+ "just now": "刚才",
107
+ "1 day ago": "1天前",
108
+ "{amount} days ago": "{amount}天前",
109
+ "1 hour ago": "1小时前",
110
+ "{amount} hours ago": "{amount}小时前",
111
+ "1 minute ago": "1分钟前",
112
+ "{amount} minutes ago": "{amount}分钟前",
113
+ "the details are fuzzy": "细节已经模糊",
114
+ "you barely remember": "你几乎记不清了",
115
+ "you are sure of it": "你对此确信无疑",
116
+ "you doubt it": "你对此存疑",
117
+ "something you have seen since speaks against it": "此后你所见所闻有与之相悖的地方",
118
+ "it comes to mind with the rest": "它和其余的事一起浮现在脑海",
119
+ "Earlier in this scene, before this moment:": "这一幕此刻之前发生的事:",
120
+ "What just happened, and what you are reacting to:": "刚才发生的事,以及你在回应的是什么:",
121
+ "- {name} intended: {intent} ({result}) {summary}": "- {name}打算:{intent}({result}){summary}",
122
+ "- {name} said \"{utterance}\" and intended: {intent} ({result}) {summary}": "- {name}说了“{utterance}”,并打算:{intent}({result}){summary}",
123
+ "Your earlier intent did not work out: {intent}\nYou are trying again, knowing the above. Decide again what you do now.": "你先前的打算没有成功:{intent}\n你带着上面这些再试一次。重新决定你现在做什么。",
124
+ "Character: {name}{summary}": "角色:{name}{summary}",
125
+ "What they believe now:": "他们现在的看法:",
126
+ "(nothing yet)": "(暂时没有)",
127
+ "What they have taken in since:": "他们此后经历的事:",
128
+ "Sort their memory.": "请整理他们的记忆。",
129
+ "not acceptable: {problems}": "不可接受:{problems}",
130
+ "{kind}, importance {importance}, {confidence}{about}{dispute}": "{kind},重要性 {importance},{confidence}{about}{dispute}",
131
+ ", about {names}": ",关于{names}",
132
+ ", something taken in since speaks against it": ",此后经历的事与之相悖",
133
+ "add: at most {max} new beliefs in one pass; merge or choose": "add:一次最多 {max} 条新看法;请合并或取舍",
134
+ "at most {max} changes in one pass": "一次最多 {max} 处修改",
135
+ "{where}: there is no thing it took in numbered {id}": "{where}:没有编号为 {id} 的经历",
136
+ "{where}: confidence is one of {options}": "{where}:confidence 须为 {options} 之一",
137
+ "{where}: unknown kind \"{kind}\"": "{where}:未知的 kind “{kind}”",
138
+ "{where}: say what it believes": "{where}:请写出它相信什么",
139
+ "{where}: at most {max} characters; say it shorter": "{where}:最多 {max} 个字符;请写得更短",
140
+ "{where}: importance runs from {min} to {max}": "{where}:importance 取值为 {min} 到 {max}",
141
+ "{where}: there is no belief numbered {id}": "{where}:没有编号为 {id} 的看法",
142
+ "{where}: one passing moment is not yet a belief; rest it on things from at least two different turns, or on one event that turned the story": "{where}:一个转瞬即逝的瞬间还不是看法;请以至少两个不同回合的经历为依据,或以一件扭转了故事的事件为依据",
143
+ "{where}: to be sure of something it must rest on things from at least two different turns": "{where}:要对某事确信,必须以至少两个不同回合的经历为依据",
144
+ "{where}: \"{name}\" is not a character; name them as they are named": "{where}:“{name}”不是角色;请使用他们的名字",
145
+ "say in a sentence what the belief claims and what the things say, before the verdict": "先用一句话说明这个看法主张什么、这些内容说了什么,再给出判断",
146
+ "the verdict is consistent or contradicted": "判断是 consistent 或 contradicted",
147
+ "a belief that can be true together with all of them names none of them": "与它们全都可以同时成立的看法,不应列出其中任何一条",
148
+ "name the things that cannot be true together with the belief": "写出与这个看法不可能同时成立的内容",
149
+ "there is no thing listed numbered {id}": "列出的内容里没有编号为 {id} 的",
150
+ "thing {id} came before the belief was formed": "内容 {id} 出现在这个看法形成之前",
151
+ "A belief held by {name}: {text}": "{name} 持有的一个看法:{text}",
152
+ "What they took in since that bears on it:": "此后他们接收到的、与之有关的内容:",
153
+ "Can the belief and each of these be true together? Name the ones that cannot be.": "这个看法与其中每一件事能否同时成立?指出不能同时成立的。",
154
+ "{names} could not be sorted this time and will be tried again: {reason}": "{names} 这一次没能整理,下次会再试:{reason}",
155
+ "{where}: belief {id} is already changed in this pass": "{where}:看法 {id} 在这一轮中已经修改过",
156
+ "{where}: say what it took in since that bears on it": "{where}:请写出此后与之相关的经历",
157
+ "{where}: thing {id} came before the belief was formed; cite what came after": "{where}:经历 {id} 发生在看法形成之前;请引用之后发生的事",
158
+ "{where}: say what changes": "{where}:请写出有何改变",
159
+ "{where}: the text must be there and at most {max} characters; leave it out to keep the belief as it is": "{where}:文字不能为空,且最多 {max} 个字符;想保持信念原样就不要写这一项",
160
+ "{where}: the confidence, the importance and the numbers are fields of their own, not part of the text": "{where}:把握程度、重要性和编号是各自独立的字段,不属于文字",
161
+ "{where}: name what speaks against the belief in contradicted_by": "{where}:在 contradicted_by 里写出与该信念相悖的内容的编号",
162
+ "{where}: a belief that something contradicts must be doubted: lower its confidence": "{where}:被事实相悖的看法必须存疑:请降低其 confidence",
163
+ "{where}: to doubt a belief, name what contradicts it in contradicted_by": "{where}:要对看法存疑,请在 contradicted_by 中写明与之相悖的经历",
164
+ "{where}: merge into a belief that stays": "{where}:请合并到保留的看法中",
165
+ "Time: {time}.": "时间:{time}。",
166
+ "The story's time moves only as you say: each round takes what you give it (elapsed_seconds in resolve_round, or the default), and advance_time skips ahead.": "故事的时间只按你说的推进:每一轮耗时由你给定(resolve_round 的 elapsed_seconds,或取默认值),advance_time 可以跳过一段时间。",
167
+ "The player was away for {duration} of real time and the story went on meanwhile: characters have been about their own business, so do not assume anyone is where or as the player left them unless the records say so.": "玩家离开了{duration}的真实时间,其间故事仍在继续:角色们各忙各的事,除非记录另有说明,不要假定任何人还在玩家离开时的位置或状态。",
168
+ "The story's time follows the real clock: it cannot be skipped, and each round takes as long as it really took.": "故事时间跟随真实时钟:无法跳过,每一轮耗时就是它实际花费的时间。",
169
+ "By their routines since you last looked: {moves}.": "按各自的日程,自你上次查看以来:{moves}。",
170
+ "{name} went to {place} ({activity})": "{name}去了{place}({activity})",
171
+ "With the player's character, and their days: {days}. The characters decide for themselves whether to keep to their day; the moment may keep them.": "与玩家角色在一起的人及其日程:{days}。是否照日程行事由角色自己决定;当下的情形也可能拖住他们。",
172
+ ", at {place}": ",在{place}",
173
+ "\"{title}\" ({with}{place}) was due {when} and is still open": "“{title}”({with}{place})原定{when},仍未了结",
174
+ "\"{title}\" ({with}{place}) is due {when}": "“{title}”({with}{place})定于{when}",
175
+ "Commitments due soon or overdue: {entries}.": "即将到期或已逾期的约定:{entries}。",
176
+ "named in the move": "被这一步行动点到",
177
+ "in the scene": "在场",
178
+ "own goal: {goal}": "自身目标:{goal}",
179
+ "faction pressure: {goal}": "组织压力:{goal}",
180
+ "high tension toward the player": "对玩家高度紧张",
181
+ "distrusts the player": "不信任玩家",
182
+ "cares about the player": "在意玩家",
183
+ "dislikes the player": "不喜欢玩家",
184
+ "Likely characters to activate, in priority order (advice only; activate only whoever the moment actually reaches):": "可能需要启动的角色,按优先级排列(仅供参考;只启动当下真正牵涉到的人):",
185
+ "socially implicated": "社交上被牵涉",
186
+ "The player's character is in {place}": "玩家角色在{place}",
187
+ "Characters here:": "在这里的角色:",
188
+ "Characters elsewhere (they perceive nothing here unless the moment reaches them):": "在别处的角色(除非当下波及他们,否则感知不到这里的事):",
189
+ "{member} - in {place} ({key})": "{member} - 在{place}({key})",
190
+ "Characters with no place (not part of this scene; they cannot be asked to act):": "没有所在地点的角色(不属于这一幕;不能让他们行动):",
191
+ "the player's character, \"{key}\"": "玩家角色,“{key}”",
192
+ "acts through \"{key}\"": "通过“{key}”行动",
193
+ "Currently: {state}": "目前:{state}",
194
+ "Scene before turn {turn}:": "第 {turn} 回合之前的场景:",
195
+ "What characters have on them:": "角色们身上带着:",
196
+ "The world acted since the last turn, by itself:": "自上一回合以来,世界自行发生的事:",
197
+ "Known beforehand, still to come (who knows of it; it will happen by itself when its time comes):": "事先已知、尚未发生的事(谁知道;时候到了会自行发生):",
198
+ "[known to {who}]": "[知情者:{who}]",
199
+ "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):": "合适时把这些织入故事,然后在 narrate 的 addressed 中说明已处理(每条会保留几个回合,之后放弃):",
200
+ "What the story keeps track of (change it with variable_changes in an outcome when what happened calls for it):": "故事追踪的内容(发生的事需要时,在结果中用 variable_changes 修改):",
201
+ "Still open in the story:": "故事中仍未了结的事:",
202
+ "Earlier events that bear on what the player just did (from the records of the story):": "与玩家刚才的行动相关的早先事件(来自故事记录):",
203
+ "turn {turn}": "第 {turn} 回合",
204
+ "You were to {title}, at {when}": "你本应{title},时间是{when}",
205
+ "You were to {title} at {place}, at {when}": "你本应在{place}:{title},时间是{when}",
206
+ " ({note})": "({note})",
207
+ "It is {now} now and the time has passed.": "现在是{now},时间已经过了。",
208
+ "It is {now} now.": "现在是{now}。",
209
+ "It was with: {who}.": "同你一起的有:{who}。",
210
+ "You are not with the player's character, and nothing of this happens in front of anyone: decide what you do about it.": "你不和玩家的角色在一起,这件事也不会发生在任何人面前:决定你要怎么处理。",
211
+ "The time you had for \"{goal}\" has passed ({when}; it is {now} now)": "你为“{goal}”预留的时间已过({when};现在是{now})",
212
+ "You are not with the player's character and nothing of this happens in front of anyone: decide what you do about it.": "你不和玩家的角色在一起,这件事也不会发生在任何人面前:决定你要怎么处理。",
213
+ "{names} noticed: {text}": "{names}注意到:{text}",
214
+ "{name} went to {place}.": "{name}去了{place}。",
215
+ "## MCP resource servers\n\nUse {tools} with the server argument naming an MCP server.": "## MCP 资源服务器\n\n使用 {tools},server 参数填 MCP 服务器的名称。",
216
+ "## MCP resource servers\n\nUse {tools} with one of these names as the server argument: {servers}.": "## MCP 资源服务器\n\n使用 {tools},server 参数填下列名称之一:{servers}。",
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
+ "Import this card into this newly created world.": "把这张卡片导入这个新建的世界。",
219
+ "Turn the SillyTavern lorebook I uploaded into this lorebook: call {tool} with file {file}.": "把我上传的 SillyTavern 世界书转成这本世界书:调用 {tool},文件为 {file}。",
220
+ "Turn the SillyTavern preset I uploaded into this preset's prompts: call {tool} with file {file}.": "把我上传的 SillyTavern 预设转成这个预设的提示词:调用 {tool},文件为 {file}。",
221
+ "Apply the narration preset I uploaded to this world: call {tool} with file {file}.": "把我上传的叙述预设应用到这个世界:调用 {tool},文件为 {file}。",
222
+ "Card: {name}": "卡片:{name}",
223
+ "Piece: {label}": "片段:{label}",
224
+ "Title: {title}": "标题:{title}",
225
+ "Keys: {keys}": "关键词:{keys}",
226
+ "Card title: {name}": "卡片标题:{name}",
227
+ "The pieces name the card title as a character.": "片段中把卡片标题当作角色提到了。",
228
+ "The card title is not named as a character by any piece.": "没有任何片段把卡片标题当作角色提到。",
229
+ "Names found:": "找到的名字:",
230
+ "{count} pieces": "{count}个片段",
231
+ "about the player's character": "关于玩家的角色",
232
+ "titles: {titles}": "标题:{titles}",
233
+ "characters": "角色",
234
+ "places": "地点",
235
+ "factions": "组织",
236
+ "things": "物品",
237
+ "(none)": "(无)",
238
+ "Make the {kind} that the player plays: {name}": "写出玩家扮演的{kind}:{name}",
239
+ "Make the {kind}: {name}": "写出{kind}:{name}",
240
+ "(also called: {names})": "(又称:{names})",
241
+ "The others in this world, which are the only ones you may refer to:": "这个世界里的其他对象,你只能提到这些:",
242
+ "Source pieces:": "来源片段:",
243
+ "(none: write only what the name itself implies, and leave the rest empty)": "(无:只写名字本身能推出的内容,其余留空)",
244
+ "The entities of this world, which are the only ones the entries may name as subjects:": "这个世界里的对象,条目只能以它们作为主题:",
245
+ "Source piece:": "来源片段:",
246
+ "The instructions of the card:": "卡片的指令:",
247
+ "Characters:": "角色:",
248
+ "Places:": "地点:",
249
+ "Things:": "物品:",
250
+ "The pieces of the card that may describe what it tracks:": "卡片中可能描述其所追踪内容的片段:",
251
+ "Entry {ref}": "条目{ref}",
252
+ "(triggers: {keys})": "(触发词:{keys})",
253
+ "Lorebook: {name}": "世界书:{name}",
254
+ "Authoring {name}": "创作 {name}",
255
+ "Card tags: {tags}": "卡片标签:{tags}",
256
+ "Scenario:": "场景:",
257
+ "Opening:": "开场:",
258
+ "Description:": "描述:",
259
+ "Creator's notes:": "作者备注:"
260
+ };
261
+ //#endregion
262
+ //#region ../dsh-roleplay-model/src/messages.ts
263
+ /** The language a setting such as `zh-CN` or `en` stands for; English when it is none that is known. */
264
+ function languageOf(code) {
265
+ return (code ?? "").trim().toLowerCase().startsWith("zh") ? "zh" : "en";
266
+ }
267
+ const fill = (template, values) => values === void 0 ? template : template.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole);
268
+ const CATALOGUES = { zh: ZH };
269
+ /**
270
+ * The texts the engine builds for a model (briefs, reports, refusals) in a language. The text written in the code is the English one and the key of
271
+ * the others; a text a language lacks is told in English, and a test keeps that from happening.
272
+ */
273
+ function translator(language) {
274
+ const catalogue = language === "en" ? void 0 : CATALOGUES[language];
275
+ return (text, values) => fill(catalogue?.[text] ?? text, values);
276
+ }
277
+ //#endregion
278
+ //#region src/shared/text.ts
279
+ /** Remove characters from either end without a backtracking regular expression. */
280
+ function trimCharacters(value, characters, edge = "both") {
281
+ let start = 0;
282
+ let end = value.length;
283
+ if (edge !== "end") while (start < end && characters.includes(value[start])) start += 1;
284
+ if (edge !== "start") while (end > start && characters.includes(value[end - 1])) end -= 1;
285
+ return value.slice(start, end);
286
+ }
287
+ /** A path-like name without its last extension. */
288
+ function withoutExtension(value) {
289
+ const dot = value.lastIndexOf(".");
290
+ return dot < 0 ? value : value.slice(0, dot);
291
+ }
292
+ //#endregion
293
+ export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
294
+
295
+ //# sourceMappingURL=text-JbWfTHbr.js.map
@@ -0,0 +1,53 @@
1
+ import { _ as finishOf, g as cutOff } from "./child-CyCViUKa.js";
2
+ import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
3
+ //#region src/host/authoring/turn-guard.ts
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;
6
+ /**
7
+ * 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
+ * - 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.
9
+ * - A reply that ran out of room is steered back to act or to sum up. DSH ends a turn whose reply was cut off as soon as it stops, so every stop after the cut-off is steered too, until the assistant finishes by itself.
10
+ * @param languageOf the language the chat's prompts are in, or nothing when the chat is not an authoring chat of this preset.
11
+ * @param reasoning the thinking level the settings give the assistants; empty leaves the chat's own.
12
+ */
13
+ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
14
+ const nudged = /* @__PURE__ */ new Map();
15
+ ctx.on("agent/request", async (payload, next) => {
16
+ const config = await next();
17
+ const level = reasoning();
18
+ if (level === "" || payload.agent.session.header.origin === "subagent" || languageOf(payload.agent.session.id) === void 0 || config.reasoningEffort === level) return config;
19
+ try {
20
+ if ((await payload.agent.ctx.llm.resolveModelInfo(config.provider, config.model, payload.signal)).reasoning?.efforts.some((effort) => effort.id === level) !== true) return config;
21
+ } catch {
22
+ return config;
23
+ }
24
+ return {
25
+ ...config,
26
+ reasoningEffort: ReasoningEffortId(level)
27
+ };
28
+ });
29
+ ctx.on("agent/turn-stopping", ({ agent, turn }) => {
30
+ if (agent.session.header.origin === "subagent") return;
31
+ const language = languageOf(agent.session.id);
32
+ if (language === void 0) return;
33
+ const key = `${agent.session.id}:${turn}`;
34
+ const told = nudged.get(key) ?? 0;
35
+ if (!(cutOff(agent) || told > 0 && finishOf(agent) !== "stop")) {
36
+ nudged.delete(key);
37
+ return;
38
+ }
39
+ if (told >= MAX_NUDGES) return;
40
+ nudged.set(key, told + 1);
41
+ agent.steer(createUserMessage({
42
+ content: [{
43
+ type: "text",
44
+ text: prompts().text("import/cut-off", language)
45
+ }],
46
+ source: { kind: "roleplay" }
47
+ }));
48
+ });
49
+ }
50
+ //#endregion
51
+ export { guardAuthoringTurns as t };
52
+
53
+ //# sourceMappingURL=turn-guard-BvCs1VxB.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-agentic-roleplay/core",
3
- "version": "0.6.1",
3
+ "version": "0.7.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,39 +76,39 @@
76
76
  "@deepseek-ai/schemastery": "^3.18.5"
77
77
  },
78
78
  "dependencies": {
79
- "@dsh-agentic-roleplay/state": "0.6.1",
79
+ "@dsh-agentic-roleplay/state": "0.7.1",
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.2",
86
- "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
87
- "@deepseek-ai/dsh-api-remotes": "0.2.1-rc.2",
88
- "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
89
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
90
- "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.2",
91
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
92
- "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.2",
93
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
94
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
95
- "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.2",
96
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
97
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.2",
98
- "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.2",
99
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
100
- "@deepseek-ai/dsh-compaction": "0.2.1-rc.2",
101
- "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.2",
102
- "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
103
- "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
104
- "@deepseek-ai/dsh-session": "0.2.1-rc.2",
105
- "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
106
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
107
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.2",
108
- "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
109
- "@deepseek-ai/dsh-token-meter": "0.2.1-rc.2",
110
- "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
111
- "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
85
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.3",
86
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.3",
87
+ "@deepseek-ai/dsh-api-remotes": "0.2.1-rc.3",
88
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.3",
89
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.3",
90
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.3",
91
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.3",
92
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.3",
93
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.3",
94
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.3",
95
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.3",
96
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.3",
97
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.3",
98
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.3",
99
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.3",
100
+ "@deepseek-ai/dsh-compaction": "0.2.1-rc.3",
101
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.3",
102
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.3",
103
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.3",
104
+ "@deepseek-ai/dsh-session": "0.2.1-rc.3",
105
+ "@deepseek-ai/dsh-session-projection": "0.2.1-rc.3",
106
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.3",
107
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.3",
108
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.3",
109
+ "@deepseek-ai/dsh-token-meter": "0.2.1-rc.3",
110
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.3",
111
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.3",
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 @@
1
+ Your last reply was cut off because it ran too long, and nothing in it was acted on. Do not reason at length: decide, and act with a tool call now. If the work is done, or what is left needs the person, finish with a short summary of what was done and what is still open.
@@ -1 +1 @@
1
- The world was not written, because of these problems. Say so to the person with the problems in plain words; run ${build} again only if you expect it to differ.
1
+ The world was not written, because of these problems. Say so to the person with the problems in plain words, and stop. Do not edit the world's files to work around them. Run ${build} again at most once, and only if you expect the problems to differ.
@@ -0,0 +1 @@
1
+ You judge one piece of a character card written for a role-playing chat tool: is the piece only an instruction to the AI or the narrator about how to write or run the game, with nothing in it about the story's own characters, places, organisations, objects, history or situation? Instructions are about style, formats, status panels, dice or game mechanics, tracking variables, generating options, or rules for the player's characters. You work only from the text you are shown: never add anything that is not in it. When the piece also describes a person, a place, an organisation, an object, the setting or the starting situation, it is not only an instruction. When you cannot tell, it is not.
@@ -0,0 +1 @@
1
+ You judge one piece of a character card written for a role-playing chat tool: is the piece only notes to the reader or the card's maker (credits, version notes, links, advertising, a changelog, a blank form or placeholder), with nothing in it about the story's own characters, places, organisations, objects, history or situation, and no instruction for the AI or narrator? You work only from the text you are shown: never add anything that is not in it. When the piece says anything about the story, or tells the AI how to write or run the game, it is not irrelevant. When you cannot tell, it is not.
@@ -0,0 +1 @@
1
+ 你上一次的回复因为太长被截断了,其中的内容没有被执行。不要长篇推理:立刻做出决定,并通过工具调用去执行。如果工作已经完成,或剩下的需要由用户来决定,就用简短的总结收尾,说明做了什么、还有什么未完成。
@@ -1 +1 @@
1
- 由于下列问题,世界没有写入。请用平实的话把这些问题告诉用户;只有在你预计结果会不同时,才再次运行 ${build}。
1
+ 由于下列问题,世界没有写入。请用平实的话把这些问题告诉用户,然后停下。不要通过修改世界的文件来绕过它们。最多再运行一次 ${build},并且只有在你预计这些问题会不同时才这样做。
@@ -0,0 +1 @@
1
+ 你要判断一张为角色扮演聊天工具写的角色卡的一个片段:这个片段是否只是给 AI 或叙述者的、关于如何写作或运行游戏的指令,其中完全没有关于故事本身的角色、地点、组织、物品、历史或处境?指令涉及文风、格式、状态栏、骰子或游戏机制、变量追踪、生成选项,或对玩家角色的规则。你只依据所给的文字:绝不添加其中没有的内容。如果这个片段同时描述了某个人、某个地点、某个组织、某件物品、背景设定或开场处境,它就不只是指令。无法判断时,它就不是。
@@ -0,0 +1 @@
1
+ 你要判断一张为角色扮演聊天工具写的角色卡的一个片段:这个片段是否只是写给读者或卡片作者的说明(署名、版本说明、链接、广告、更新日志、空白表单或占位符),其中完全没有关于故事本身的角色、地点、组织、物品、历史或处境,也没有给 AI 或叙述者的指令?你只依据所给的文字:绝不添加其中没有的内容。如果这个片段说到了故事的任何内容,或告诉 AI 如何写作或运行游戏,它就不是无关内容。无法判断时,它就不是。
@@ -1,25 +0,0 @@
1
- //#region src/shared/chat.ts
2
- const CHAT_PREFIX = "session-";
3
- const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
4
- /** The DSH chat of a roleplay session is named after the session's id. */
5
- function chatSessionId(sessionId) {
6
- return `${CHAT_PREFIX}${sessionId}`;
7
- }
8
- /** The roleplay session a DSH chat id could belong to; ordinary DSH chats have ids of the same shape. */
9
- function roleplaySessionOf(chat) {
10
- if (!chat.startsWith(CHAT_PREFIX)) return void 0;
11
- const id = chat.slice(8);
12
- return UUID_V4.test(id) ? id : void 0;
13
- }
14
- //#endregion
15
- //#region src/host/prompts/access.ts
16
- /** The prompt `id` in `language`, from the library of the agent's own context. */
17
- function promptFor(agent, id, language, variables) {
18
- const library = agent.ctx.get("roleplayPrompts");
19
- if (library === void 0) throw new Error("the prompt library is not running");
20
- return library.text(id, language, variables, roleplaySessionOf(agent.session.id));
21
- }
22
- //#endregion
23
- export { chatSessionId as n, roleplaySessionOf as r, promptFor as t };
24
-
25
- //# sourceMappingURL=access-EbNdZFbk.js.map
@@ -1,18 +0,0 @@
1
- //#region src/shared/text.ts
2
- /** Remove characters from either end without a backtracking regular expression. */
3
- function trimCharacters(value, characters, edge = "both") {
4
- let start = 0;
5
- let end = value.length;
6
- if (edge !== "end") while (start < end && characters.includes(value[start])) start += 1;
7
- if (edge !== "start") while (end > start && characters.includes(value[end - 1])) end -= 1;
8
- return value.slice(start, end);
9
- }
10
- /** A path-like name without its last extension. */
11
- function withoutExtension(value) {
12
- const dot = value.lastIndexOf(".");
13
- return dot < 0 ? value : value.slice(0, dot);
14
- }
15
- //#endregion
16
- export { withoutExtension as n, trimCharacters as t };
17
-
18
- //# sourceMappingURL=text-CT1re6XT.js.map