@dsh-agentic-roleplay/core 0.3.4 → 0.3.6

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/authoring.js +5 -3
  2. package/lib/client.js +3260 -493
  3. package/lib/client.js.map +1 -1
  4. package/lib/{deliver-CpZOxBX5.js → deliver-BBgciEEK.js} +3 -2
  5. package/lib/doctor.js +3 -3
  6. package/lib/{gallery-CtFDL22W.js → gallery-DIEgETzU.js} +2 -2
  7. package/lib/generator-DJ48HxPI.js +145 -0
  8. package/lib/{hooks-KTCR3fNJ.js → hooks-DkwFGtNH.js} +3 -3
  9. package/lib/images.js +4 -3
  10. package/lib/index.js +889 -52
  11. package/lib/language-BgyxtB2h.js +38 -0
  12. package/lib/{generator-B6FxlKOV.js → library-9JB9zw5a.js} +2 -143
  13. package/lib/{language-DWVwi1R7.js → load-CVwJjIJ5.js} +11 -45
  14. package/lib/lorebook-author-tools-Bj31z1cu.js +619 -0
  15. package/lib/lorebook-authoring.js +67 -0
  16. package/lib/orchestration.js +22 -14
  17. package/lib/pack-jail-2XztyYAX.js +1980 -0
  18. package/lib/{packs-BYjrAen6.js → packs-xHRCcGdb.js} +3 -29
  19. package/lib/{presenter-agent-CiEVKcjJ.js → presenter-agent-DnNEG_Mn.js} +4 -3
  20. package/lib/preset-D0FMSeZ9.js +59 -0
  21. package/lib/preset-author-tools-BxycmoAr.js +276 -0
  22. package/lib/preset-authoring.js +53 -0
  23. package/lib/presets-gkBWAiVb.js +374 -0
  24. package/lib/{reflection-waxFg1x-.js → reflection-q0UpwXlx.js} +130 -8
  25. package/lib/{pack-jail-CybSNzxr.js → tools-Dy1fgP6B.js} +454 -2303
  26. package/package.json +4 -2
  27. package/prompts/en/import/lorebook.md +7 -0
  28. package/prompts/en/lorebook/persona.md +1 -0
  29. package/prompts/en/lorebook/procedure.md +1 -0
  30. package/prompts/en/lorebook/welcome.md +1 -0
  31. package/prompts/en/preset/persona.md +1 -0
  32. package/prompts/en/preset/procedure.md +1 -0
  33. package/prompts/en/preset/welcome.md +1 -0
  34. package/prompts/zh/import/lorebook.md +7 -0
  35. package/prompts/zh/lorebook/persona.md +1 -0
  36. package/prompts/zh/lorebook/procedure.md +1 -0
  37. package/prompts/zh/lorebook/welcome.md +1 -0
  38. package/prompts/zh/preset/persona.md +1 -0
  39. package/prompts/zh/preset/procedure.md +1 -0
  40. package/prompts/zh/preset/welcome.md +1 -0
@@ -1,15 +1,17 @@
1
1
  import { n as chatSessionId, r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
2
- import { _ as API_PREFIX, y as INTENT_STATUSES } from "./packs-BYjrAen6.js";
3
- import { a as whereabouts, d as sameWords, f as referent, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-waxFg1x-.js";
2
+ import { b as INTENT_STATUSES } from "./presets-gkBWAiVb.js";
3
+ import { a as whereabouts, g as referent, h as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-q0UpwXlx.js";
4
4
  import "./settings-CA6icLL_.js";
5
- import { D as ReflectionRefusedError, a as wrongLanguage } from "./language-DWVwi1R7.js";
6
- import { B as RESULTS, F as describeWhen, H as languageOf, M as ClockError, S as MAX_OOC_ANSWER, U as translator, m as createTools$1, p as PREVIEW_TOOL, u as externalGiven, w as toolEnabled, x as AUTHORING_NEEDS, z as zoneOf } from "./deliver-CpZOxBX5.js";
5
+ import { C as ReflectionRefusedError } from "./load-CVwJjIJ5.js";
6
+ import { B as RESULTS, F as describeWhen, H as languageOf, M as ClockError, S as MAX_OOC_ANSWER, U as translator, m as createTools$1, p as PREVIEW_TOOL, u as externalGiven, w as toolEnabled, x as AUTHORING_NEEDS, z as zoneOf } from "./deliver-BBgciEEK.js";
7
7
  import { a as liveSettings } from "./narration-DK2kiIjE.js";
8
8
  import { a as runChild, d as tokensOf, i as childTrace, l as currentTurn, n as childSampling, t as childModel, u as estimateAnswer } from "./child-CFjnaTZt.js";
9
- import { T as uniqueKey, o as addToLibrary, w as slug } from "./generator-B6FxlKOV.js";
10
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CtFDL22W.js";
11
- import { a as writeVerdicts, i as readVerdicts, n as installHooks, r as storesOf } from "./hooks-KTCR3fNJ.js";
12
- import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-CiEVKcjJ.js";
9
+ import { b as slug, t as addToLibrary, x as uniqueKey } from "./library-9JB9zw5a.js";
10
+ import { a as wrongLanguage } from "./language-BgyxtB2h.js";
11
+ import { _ as API_PREFIX } from "./packs-xHRCcGdb.js";
12
+ import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-DIEgETzU.js";
13
+ import { a as writeVerdicts, i as readVerdicts, n as installHooks, r as storesOf } from "./hooks-DkwFGtNH.js";
14
+ import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-DnNEG_Mn.js";
13
15
  import { join } from "node:path";
14
16
  import { existsSync } from "node:fs";
15
17
  import { SessionId } from "@deepseek-ai/dsh-session";
@@ -2393,12 +2395,7 @@ var TurnEngine = class {
2393
2395
  async reflect(chat) {
2394
2396
  const store = this.stores(chat);
2395
2397
  if (store === void 0) throw new Error(`no story for chat ${chat}`);
2396
- const turning = this.states.get(chat);
2397
- if (turning !== void 0 && [
2398
- "resolving",
2399
- "retrying",
2400
- "between"
2401
- ].includes(turning.phase)) throw new ReflectionRefusedError("a turn is being played; reflect when it is over");
2398
+ if (this.playing(chat)) throw new ReflectionRefusedError("a turn is being played; reflect when it is over");
2402
2399
  const delivered = this.delivered.get(chat);
2403
2400
  if (delivered !== void 0 && store.pendingCommits().length > 0) this.write({
2404
2401
  chat,
@@ -2412,6 +2409,15 @@ var TurnEngine = class {
2412
2409
  turn: store.story.metadata.get().turns
2413
2410
  }, cancel.signal);
2414
2411
  }
2412
+ /** Whether a turn is being played: characters are being asked or the game master is between rounds. */
2413
+ playing(chat) {
2414
+ const turning = this.states.get(chat);
2415
+ return turning !== void 0 && [
2416
+ "resolving",
2417
+ "retrying",
2418
+ "between"
2419
+ ].includes(turning.phase);
2420
+ }
2415
2421
  /** Whether a reflection is running for the chat. */
2416
2422
  reflecting(chat) {
2417
2423
  return this.afterTurn.isReflecting(chat);
@@ -2974,9 +2980,11 @@ function apply(ctx) {
2974
2980
  ctx.effect(() => {
2975
2981
  ctx.roleplayOrchestration.reflect = (chat) => engine.reflect(chat);
2976
2982
  ctx.roleplayOrchestration.reflecting = (chat) => engine.reflecting(chat);
2983
+ ctx.roleplayOrchestration.playing = (chat) => engine.playing(chat);
2977
2984
  return () => {
2978
2985
  ctx.roleplayOrchestration.reflect = () => Promise.reject(/* @__PURE__ */ new Error("the orchestration is not running"));
2979
2986
  ctx.roleplayOrchestration.reflecting = () => false;
2987
+ ctx.roleplayOrchestration.playing = () => false;
2980
2988
  };
2981
2989
  }, "roleplay: reflection control");
2982
2990
  ctx.effect(() => {