@dsh-agentic-roleplay/core 0.11.1 → 0.12.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 (61) hide show
  1. package/lib/{access-Md1YTSX1.js → access-DifaiHrI.js} +3 -15
  2. package/lib/{authoring-tools-BFdw7ahj.js → authoring-tools-VOaXzr_R.js} +58 -766
  3. package/lib/authoring.js +136 -13
  4. package/lib/{child-C9nPIy9j.js → child-DzZ-aI6k.js} +130 -2
  5. package/lib/client.js +17093 -2269
  6. package/lib/client.js.map +1 -1
  7. package/lib/compaction.js +3 -3
  8. package/lib/dev-context-Bdm-eVer.js +40 -0
  9. package/lib/doctor.js +5 -3
  10. package/lib/{gallery-BWHmjogd.js → gallery-Ctz-UoFk.js} +3 -3
  11. package/lib/{generator-QCdm8nUh.js → generator-Cv6WWmZT.js} +2 -2
  12. package/lib/helper.js +15 -1
  13. package/lib/{hooks-C2U1-8ur.js → hooks-BdR3mBeM.js} +751 -344
  14. package/lib/images.js +4 -4
  15. package/lib/index.js +342 -463
  16. package/lib/jail-Cp4zEfip.js +107 -0
  17. package/lib/{library-4zmCAshR.js → library-BU2A_Dx8.js} +3 -3
  18. package/lib/{lorebook-author-tools-Bjfjt3bg.js → lorebook-author-tools-DUKcQu8P.js} +20 -7
  19. package/lib/lorebook-authoring.js +12 -5
  20. package/lib/{narration-b_VBEUWn.js → narration-CDsJ5wxH.js} +29 -2
  21. package/lib/orchestration.js +615 -48
  22. package/lib/{pack-jail-Ci9bIeDI.js → pack-jail-CzHQu0n3.js} +559 -23
  23. package/lib/{packs-CYkozh8Q.js → packs-BZ-45J4-.js} +2 -2
  24. package/lib/{presenter-agent-CqkAL03Q.js → presenter-agent-C2ZkoxZu.js} +9 -9
  25. package/lib/{preset-B-35yUmt.js → preset-BPnRPW-1.js} +4 -4
  26. package/lib/{preset-author-tools-BUymqZM5.js → preset-author-tools-DBqPwn-o.js} +9 -8
  27. package/lib/preset-authoring.js +11 -6
  28. package/lib/{reflection-B9N0z3KY.js → reflection-Cuy0YLv0.js} +22 -16
  29. package/lib/{presets-_U-xroo0.js → serial-BZNeK57v.js} +1305 -331
  30. package/lib/service-mRKwpWjX.js +140 -0
  31. package/lib/{text-C2AGl7Je.js → text-Dfv8S8eq.js} +27 -2
  32. package/lib/{turn-guard-C0M3rXEN.js → turn-guard-xaFxYc1T.js} +3 -3
  33. package/locale/de.json +6 -0
  34. package/locale/en.json +6 -0
  35. package/locale/es.json +6 -0
  36. package/locale/fr.json +6 -0
  37. package/locale/ja.json +6 -0
  38. package/locale/pt.json +6 -0
  39. package/locale/ru.json +6 -0
  40. package/locale/zh.json +6 -0
  41. package/package.json +34 -34
  42. package/prompts/en/import/finish-ok.md +1 -1
  43. package/prompts/en/import/generator.md +1 -1
  44. package/prompts/en/import/style.md +2 -1
  45. package/prompts/en/import/variables.md +2 -1
  46. package/prompts/en/roleplay/character-lookup.md +1 -1
  47. package/prompts/en/roleplay/decide-errand.md +1 -0
  48. package/prompts/en/roleplay/decide-message.md +1 -0
  49. package/prompts/en/roleplay/dream.md +1 -0
  50. package/prompts/en/roleplay/gate-repeat.md +1 -0
  51. package/prompts/en/world/procedure.md +1 -1
  52. package/prompts/zh/import/finish-ok.md +1 -1
  53. package/prompts/zh/import/generator.md +1 -1
  54. package/prompts/zh/import/style.md +2 -1
  55. package/prompts/zh/import/variables.md +2 -1
  56. package/prompts/zh/roleplay/character-lookup.md +1 -1
  57. package/prompts/zh/roleplay/decide-errand.md +1 -0
  58. package/prompts/zh/roleplay/decide-message.md +1 -0
  59. package/prompts/zh/roleplay/dream.md +1 -0
  60. package/prompts/zh/roleplay/gate-repeat.md +1 -0
  61. package/prompts/zh/world/procedure.md +1 -1
package/lib/compaction.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as liveSettings, t as decodeOutput } from "./narration-b_VBEUWn.js";
2
- import { l as roleplaySessionOf, t as promptFor } from "./access-Md1YTSX1.js";
3
- import { E as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
1
+ import { a as liveSettings, t as decodeOutput } from "./narration-CDsJ5wxH.js";
2
+ import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-DzZ-aI6k.js";
3
+ import { t as promptFor } from "./access-DifaiHrI.js";
4
4
  import { join } from "node:path";
5
5
  import { sessionFolder } from "@dsh-agentic-roleplay/state";
6
6
  import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
@@ -0,0 +1,40 @@
1
+ // src/host/prompts/dev-context.ts
2
+ /**
3
+ * What the Web bundle's `harness-dev-context` plugin says to every agent: where the DSH checkout is, that
4
+ * the harness may be inspected and extended, and what "this page" is. It orients an agent working on DSH
5
+ * itself. A game master, a character, an author or a doctor works on a story: the text is noise in every
6
+ * prompt, it names this machine's paths, and it points at the browser tab instead of the scene.
7
+ *
8
+ * `SystemPrompt` resolves a contribution by name at the nearest scope, so a registration made here — in
9
+ * a preset's scope — shadows the profile's registration for that preset's agents and leaves every other
10
+ * session in the profile as DSH made it. Only the name and order have to match; empty text contributes
11
+ * nothing.
12
+ */
13
+ const SILENCED = [{
14
+ name: "harness:source",
15
+ section: "HARNESS_SOURCE",
16
+ context: "HARNESS_SOURCE"
17
+ }, {
18
+ name: "app:web-surface",
19
+ section: "WEB_SURFACE",
20
+ context: "WEB_SURFACE"
21
+ }];
22
+ function silenceHarnessDevContext(ctx) {
23
+ for (const entry of SILENCED) {
24
+ ctx.systemPrompt.section({
25
+ name: entry.name,
26
+ order: ctx.systemPrompt.getSectionOrder(entry.section),
27
+ interpolate: false,
28
+ text: ""
29
+ });
30
+ ctx.systemPrompt.context({
31
+ name: entry.name,
32
+ order: ctx.systemPrompt.getContextOrder(entry.context),
33
+ interpolate: false,
34
+ text: ""
35
+ });
36
+ }
37
+ }
38
+ export { silenceHarnessDevContext as t };
39
+
40
+ //# sourceMappingURL=dev-context-Bdm-eVer.js.map
package/lib/doctor.js CHANGED
@@ -1,7 +1,8 @@
1
- import { c as chatSessionId } from "./access-Md1YTSX1.js";
1
+ import { t as silenceHarnessDevContext } from "./dev-context-Bdm-eVer.js";
2
+ import { A as chatSessionId } from "./child-DzZ-aI6k.js";
2
3
  import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
3
- import { i as externalTools, t as externalToolLimit } from "./hooks-C2U1-8ur.js";
4
- import { a as liveSettings } from "./narration-b_VBEUWn.js";
4
+ import { o as externalTools, t as externalToolLimit } from "./hooks-BdR3mBeM.js";
5
+ import { a as liveSettings } from "./narration-CDsJ5wxH.js";
5
6
  import { join } from "node:path";
6
7
  import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
7
8
  import { existsSync } from "node:fs";
@@ -77,6 +78,7 @@ function doctorApproval(exec) {
77
78
  };
78
79
  }
79
80
  function apply(ctx) {
81
+ silenceHarnessDevContext(ctx);
80
82
  const sessionsDir = () => join(ctx.roleplayRoot.path, "sessions");
81
83
  const resolve = (chat) => {
82
84
  const id = doctorSessionOf(chat);
@@ -1,5 +1,5 @@
1
- import { n as atomicWrite } from "./access-Md1YTSX1.js";
2
- import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-4zmCAshR.js";
1
+ import { n as atomicWrite } from "./access-DifaiHrI.js";
2
+ import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-BU2A_Dx8.js";
3
3
  import { join, sep } from "node:path";
4
4
  import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
5
5
  // src/host/images/gallery.ts
@@ -187,4 +187,4 @@ async function updateImage(sessionFolder, path, update) {
187
187
  }
188
188
  export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
189
189
 
190
- //# sourceMappingURL=gallery-BWHmjogd.js.map
190
+ //# sourceMappingURL=gallery-Ctz-UoFk.js.map
@@ -1,4 +1,4 @@
1
- import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-4zmCAshR.js";
1
+ import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-BU2A_Dx8.js";
2
2
  // src/host/images/generator.ts
3
3
  const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
4
4
  /** What a reference image shows: the subject and its stable look. */
@@ -147,4 +147,4 @@ async function generateTransientImage(service, request) {
147
147
  }
148
148
  export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
149
149
 
150
- //# sourceMappingURL=generator-QCdm8nUh.js.map
150
+ //# sourceMappingURL=generator-Cv6WWmZT.js.map
package/lib/helper.js CHANGED
@@ -1,4 +1,9 @@
1
- import { o as helpers } from "./child-C9nPIy9j.js";
1
+ import { t as silenceHarnessDevContext } from "./dev-context-Bdm-eVer.js";
2
+ import { o as helpers } from "./child-DzZ-aI6k.js";
3
+ import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
4
+ import { t as registerFoldersJail } from "./jail-Cp4zEfip.js";
5
+ import { join } from "node:path";
6
+ import { sessionFolder } from "@dsh-agentic-roleplay/state";
2
7
  // src/helper.ts
3
8
  const name = "@dsh-agentic-roleplay/core/helper";
4
9
  const inject = ["tools", "systemPrompt"];
@@ -7,6 +12,7 @@ const inject = ["tools", "systemPrompt"];
7
12
  * one child's is found by its session id: its persona, and the equipment its caller set up for it when it was created.
8
13
  */
9
14
  function apply(ctx) {
15
+ silenceHarnessDevContext(ctx);
10
16
  ctx.systemPrompt.section({
11
17
  name: "ROLEPLAY_HELPER_PERSONA",
12
18
  order: ctx.systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_PREFIX"),
@@ -23,6 +29,14 @@ function apply(ctx) {
23
29
  interpolate: false,
24
30
  text: ""
25
31
  });
32
+ const rootOf = () => ctx.get("roleplayRoot")?.path;
33
+ registerFoldersJail(ctx, {
34
+ roots: async (session) => {
35
+ const root = rootOf();
36
+ return root === void 0 ? void 0 : await storyRoots(root, sessionFolder(join(root, "sessions"), session));
37
+ },
38
+ workspace: () => workspaceOf(rootOf() ?? "")
39
+ });
26
40
  ctx.on("agent/created", ({ agent }) => {
27
41
  helpers.get(agent.session.id)?.setup(agent);
28
42
  });