@dsh-agentic-roleplay/core 0.3.1 → 0.3.3

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 (39) hide show
  1. package/lib/authoring.js +13 -2
  2. package/lib/child-lPncV1ps.js +380 -0
  3. package/lib/client.js +1526 -356
  4. package/lib/client.js.map +1 -1
  5. package/lib/compaction.js +1 -1
  6. package/lib/deliver-De62a8i9.js +1929 -0
  7. package/lib/doctor-chat-ByDfCMeo.js +17 -0
  8. package/lib/doctor.js +95 -0
  9. package/lib/{documents-DtlY2IRt.js → documents-Do4lz4SB.js} +549 -64
  10. package/lib/{gallery-DACG5eh2.js → gallery-CtFDL22W.js} +2 -2
  11. package/lib/{generator-DGYcLMp7.js → generator-B6FxlKOV.js} +2 -378
  12. package/lib/hooks-Ka22sFNy.js +1019 -0
  13. package/lib/images.js +3 -3
  14. package/lib/index.js +303 -190
  15. package/lib/language-DWVwi1R7.js +520 -0
  16. package/lib/narration-DK2kiIjE.js +141 -0
  17. package/lib/orchestration.js +777 -2542
  18. package/lib/{packs-CkRZDCsV.js → packs-BYjrAen6.js} +4 -518
  19. package/lib/{presenter-agent-PK9JYExk.js → presenter-agent-Dt21K96b.js} +4 -3
  20. package/lib/{deliver-BDW5WZvc.js → reflection-md7BCYCl.js} +350 -769
  21. package/lib/{narration-5ig7Dg28.js → settings-CA6icLL_.js} +156 -141
  22. package/package.json +3 -2
  23. package/prompts/en/doctor/persona.md +1 -0
  24. package/prompts/en/doctor/procedure.md +5 -0
  25. package/prompts/en/doctor/welcome.md +1 -0
  26. package/prompts/en/import/character.md +1 -0
  27. package/prompts/en/roleplay/dice.md +7 -0
  28. package/prompts/en/roleplay/game-master.md +2 -0
  29. package/prompts/en/roleplay/reflection-check.md +5 -0
  30. package/prompts/en/roleplay/reflection.md +5 -1
  31. package/prompts/zh/doctor/persona.md +1 -0
  32. package/prompts/zh/doctor/procedure.md +5 -0
  33. package/prompts/zh/doctor/welcome.md +1 -0
  34. package/prompts/zh/import/character.md +1 -0
  35. package/prompts/zh/roleplay/dice.md +7 -0
  36. package/prompts/zh/roleplay/game-master.md +2 -0
  37. package/prompts/zh/roleplay/reflection-check.md +5 -0
  38. package/prompts/zh/roleplay/reflection.md +5 -1
  39. package/lib/src-CWTNeL6Y.js +0 -128
package/lib/client.js CHANGED
@@ -26,16 +26,16 @@ window.__ModuleLoader__.load({
26
26
  }
27
27
  //#endregion
28
28
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/PageTabs.module.css.mjs
29
- const css$25 = ".rp_Poldga_tabs{scrollbar-width:none;gap:24px;margin-bottom:-1px;display:flex;overflow-x:auto}.rp_Poldga_tabs::-webkit-scrollbar{display:none}.rp_Poldga_tab{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:0;margin:0;padding:8px 0;font-size:13px;line-height:20px;box-shadow:inset 0 -2px #0000}.rp_Poldga_tab:hover{color:var(--dsw-alias-label-primary)}.rp_Poldga_tab[aria-selected=true]{color:var(--dsw-alias-state-business-primary);font-weight:500;box-shadow:inset 0 -2px}.rp_Poldga_tab:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px;border-radius:var(--dsw-radius-xs)}";
30
- const key$25 = "src/client/panel/PageTabs.module.css";
31
- let tag$25 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$25) + "]");
32
- if (tag$25 === null) {
33
- tag$25 = document.createElement("style");
34
- tag$25.dataset.plugin = "@dsh-agentic-roleplay/core";
35
- tag$25.dataset.pluginCss = key$25;
36
- document.head.appendChild(tag$25);
37
- }
38
- tag$25.textContent = css$25;
29
+ const css$26 = ".rp_Poldga_tabs{scrollbar-width:none;gap:24px;margin-bottom:-1px;display:flex;overflow-x:auto}.rp_Poldga_tabs::-webkit-scrollbar{display:none}.rp_Poldga_tab{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:0;margin:0;padding:8px 0;font-size:13px;line-height:20px;box-shadow:inset 0 -2px #0000}.rp_Poldga_tab:hover{color:var(--dsw-alias-label-primary)}.rp_Poldga_tab[aria-selected=true]{color:var(--dsw-alias-state-business-primary);font-weight:500;box-shadow:inset 0 -2px}.rp_Poldga_tab:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px;border-radius:var(--dsw-radius-xs)}";
30
+ const key$26 = "src/client/panel/PageTabs.module.css";
31
+ let tag$26 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$26) + "]");
32
+ if (tag$26 === null) {
33
+ tag$26 = document.createElement("style");
34
+ tag$26.dataset.plugin = "@dsh-agentic-roleplay/core";
35
+ tag$26.dataset.pluginCss = key$26;
36
+ document.head.appendChild(tag$26);
37
+ }
38
+ tag$26.textContent = css$26;
39
39
  var PageTabs_module_css_default = {
40
40
  "tab": "rp_Poldga_tab",
41
41
  "tabs": "rp_Poldga_tabs"
@@ -82,21 +82,21 @@ window.__ModuleLoader__.load({
82
82
  }
83
83
  //#endregion
84
84
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/RoleplayPanel.module.css.mjs
85
- const css$24 = ".rp_ua5gBa_panel{min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;flex:1 1 0;display:flex}.rp_ua5gBa_header{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;padding:12px 24px 0}.rp_ua5gBa_title{margin:0 0 4px;font-size:14px;font-weight:500;line-height:22px}.rp_ua5gBa_body{flex-direction:column;flex:1 1 0;min-height:0;padding:12px 24px 16px;display:flex}@media (width<=640px){.rp_ua5gBa_header,.rp_ua5gBa_body{padding-inline:16px}}";
86
- const key$24 = "src/client/panel/RoleplayPanel.module.css";
87
- let tag$24 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$24) + "]");
88
- if (tag$24 === null) {
89
- tag$24 = document.createElement("style");
90
- tag$24.dataset.plugin = "@dsh-agentic-roleplay/core";
91
- tag$24.dataset.pluginCss = key$24;
92
- document.head.appendChild(tag$24);
85
+ const css$25 = ".rp_ua5gBa_panel{min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;flex:1 1 0;display:flex}.rp_ua5gBa_header{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;padding:12px 24px 0}.rp_ua5gBa_title{margin:0 0 4px;font-size:14px;font-weight:500;line-height:22px}.rp_ua5gBa_body{flex-direction:column;flex:1 1 0;min-height:0;padding:12px 24px 16px;display:flex}@media (width<=640px){.rp_ua5gBa_header,.rp_ua5gBa_body{padding-inline:16px}}";
86
+ const key$25 = "src/client/panel/RoleplayPanel.module.css";
87
+ let tag$25 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$25) + "]");
88
+ if (tag$25 === null) {
89
+ tag$25 = document.createElement("style");
90
+ tag$25.dataset.plugin = "@dsh-agentic-roleplay/core";
91
+ tag$25.dataset.pluginCss = key$25;
92
+ document.head.appendChild(tag$25);
93
93
  }
94
- tag$24.textContent = css$24;
94
+ tag$25.textContent = css$25;
95
95
  var RoleplayPanel_module_css_default = {
96
- "body": "rp_ua5gBa_body",
97
96
  "title": "rp_ua5gBa_title",
98
- "header": "rp_ua5gBa_header",
99
- "panel": "rp_ua5gBa_panel"
97
+ "panel": "rp_ua5gBa_panel",
98
+ "body": "rp_ua5gBa_body",
99
+ "header": "rp_ua5gBa_header"
100
100
  };
101
101
  //#endregion
102
102
  //#region src/client/panel/RoleplayPanel.tsx
@@ -143,7 +143,7 @@ window.__ModuleLoader__.load({
143
143
  }
144
144
  //#endregion
145
145
  //#region src/client/panel/locales.ts
146
- const dictionaries$13 = {
146
+ const dictionaries$15 = {
147
147
  en: {
148
148
  label: "Role Play",
149
149
  heading: "DSH Agentic Role Play",
@@ -204,7 +204,7 @@ window.__ModuleLoader__.load({
204
204
  /** Adds the Role Play entry to the sidebar and the main panel it opens. */
205
205
  function registerPanel(ctx) {
206
206
  const t = ctx.locale.bind(NAMESPACE$10);
207
- ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$13), "roleplay: panel dictionaries");
207
+ ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$15), "roleplay: panel dictionaries");
208
208
  const pages = createPagesSource(ctx);
209
209
  ctx.effect(() => pages.start(), "roleplay: page list");
210
210
  const handle = createPanelStore();
@@ -734,51 +734,51 @@ window.__ModuleLoader__.load({
734
734
  const isDirty = (character, draft) => Object.keys(editOf$1(character, draft)).length > 0;
735
735
  //#endregion
736
736
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/CharactersPanel.module.css.mjs
737
- const css$23 = ".rp_5ZMIxq_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_5ZMIxq_tabs{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;gap:4px;padding:0 24px;display:flex;overflow-x:auto}.rp_5ZMIxq_tab{font:inherit;white-space:nowrap;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;flex:none;margin-bottom:-1px;padding:12px 10px 10px;font-size:13px;line-height:20px}.rp_5ZMIxq_tabOn{color:var(--dsw-alias-state-business-primary);border-bottom-color:var(--dsw-alias-state-business-primary);font-weight:500}.rp_5ZMIxq_body{flex:1 1 0;min-height:0;overflow-y:auto}.rp_5ZMIxq_sheet{box-sizing:border-box;flex-direction:column;gap:20px;max-width:760px;padding:24px 24px 240px;display:flex}.rp_5ZMIxq_head{align-items:flex-start;gap:20px;display:flex}.rp_5ZMIxq_portrait{aspect-ratio:3/4;object-fit:cover;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);width:150px;height:auto;display:block}.rp_5ZMIxq_portraitBox{border-radius:var(--dsw-radius-lg);width:150px;height:200px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;flex:0 0 150px;padding:0;display:block;position:relative}.rp_5ZMIxq_portraitBox:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.rp_5ZMIxq_portraitBox:disabled{cursor:not-allowed}.rp_5ZMIxq_portraitAction{box-sizing:border-box;border-radius:0 0 var(--dsw-radius-lg) var(--dsw-radius-lg);color:#fff;text-align:center;opacity:0;background:#0000009e;padding:7px 6px;font-size:12px;line-height:16px;transition:opacity .12s;position:absolute;bottom:1px;left:1px;right:1px}.rp_5ZMIxq_portraitBox:hover .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:focus-visible .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:disabled .rp_5ZMIxq_portraitAction{opacity:1}.rp_5ZMIxq_portraitError,.rp_5ZMIxq_portraitHint{margin:12px 24px 0;font-size:12px}.rp_5ZMIxq_portraitError{color:var(--dsw-alias-state-danger-primary)}.rp_5ZMIxq_portraitHint{color:var(--dsw-alias-label-secondary)}.rp_5ZMIxq_placeholder{box-sizing:border-box;color:var(--dsw-alias-label-secondary);flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_initial{opacity:.6;font-size:48px;font-weight:500;line-height:1}.rp_5ZMIxq_missing{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_meta{flex-direction:column;flex:1 1 0;gap:10px;min-width:0;display:flex}.rp_5ZMIxq_section{border-top:.5px solid var(--dsw-alias-border-l4);flex-direction:column;gap:6px;padding-top:16px;display:flex}.rp_5ZMIxq_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:500;line-height:20px}.rp_5ZMIxq_empty{color:var(--dsw-alias-label-tertiary);margin:0;padding:0 24px;font-size:13px}.rp_5ZMIxq_section .rp_5ZMIxq_empty{padding:0}.rp_5ZMIxq_tabsSpace{flex:auto}.rp_5ZMIxq_voiceInline{min-width:220px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_5ZMIxq_bar{border-bottom:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-2);flex:none;justify-content:flex-end;align-items:center;gap:8px;padding:6px 24px;display:flex}.rp_5ZMIxq_barText{color:var(--dsw-alias-label-secondary);margin-right:auto;font-size:12px}.rp_5ZMIxq_nameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:var(--dsw-alias-label-primary);font:inherit;padding:4px 8px;font-size:14px;line-height:22px}.rp_5ZMIxq_row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_grid{grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:10px 12px;display:grid}.rp_5ZMIxq_field{flex-direction:column;gap:4px;min-width:0;display:flex}.rp_5ZMIxq_wide{grid-column:1/-1}.rp_5ZMIxq_label,.rp_5ZMIxq_help{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_error{color:var(--dsw-alias-state-error-primary);font-size:12px}.rp_5ZMIxq_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:4px 8px;font-size:13px}.rp_5ZMIxq_area{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:96px;color:inherit;font:inherit;resize:vertical;padding:6px 8px;font-size:13px;line-height:20px}.rp_5ZMIxq_goal{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);flex-direction:column;gap:8px;padding:10px;display:flex}.rp_5ZMIxq_row>.rp_5ZMIxq_select{width:auto;min-width:110px}.rp_5ZMIxq_select:focus-visible,.rp_5ZMIxq_area:focus-visible,.rp_5ZMIxq_nameInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}@media (width<=640px){.rp_5ZMIxq_sheet{padding-inline:16px}.rp_5ZMIxq_head{flex-direction:column}.rp_5ZMIxq_portraitBox,.rp_5ZMIxq_portrait{width:120px}.rp_5ZMIxq_portraitBox{flex-basis:120px;height:160px}.rp_5ZMIxq_bar{flex-wrap:wrap;padding-inline:16px}.rp_5ZMIxq_voiceInline{width:100%;min-width:0}}";
738
- const key$23 = "src/client/world-editor/CharactersPanel.module.css";
739
- let tag$23 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$23) + "]");
740
- if (tag$23 === null) {
741
- tag$23 = document.createElement("style");
742
- tag$23.dataset.plugin = "@dsh-agentic-roleplay/core";
743
- tag$23.dataset.pluginCss = key$23;
744
- document.head.appendChild(tag$23);
737
+ const css$24 = ".rp_5ZMIxq_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_5ZMIxq_tabs{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;gap:4px;padding:0 24px;display:flex;overflow-x:auto}.rp_5ZMIxq_tab{font:inherit;white-space:nowrap;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;flex:none;margin-bottom:-1px;padding:12px 10px 10px;font-size:13px;line-height:20px}.rp_5ZMIxq_tabOn{color:var(--dsw-alias-state-business-primary);border-bottom-color:var(--dsw-alias-state-business-primary);font-weight:500}.rp_5ZMIxq_body{flex:1 1 0;min-height:0;overflow-y:auto}.rp_5ZMIxq_sheet{box-sizing:border-box;flex-direction:column;gap:20px;max-width:760px;padding:24px 24px 240px;display:flex}.rp_5ZMIxq_head{align-items:flex-start;gap:20px;display:flex}.rp_5ZMIxq_portrait{aspect-ratio:3/4;object-fit:cover;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);width:150px;height:auto;display:block}.rp_5ZMIxq_portraitBox{border-radius:var(--dsw-radius-lg);width:150px;height:200px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;flex:0 0 150px;padding:0;display:block;position:relative}.rp_5ZMIxq_portraitBox:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.rp_5ZMIxq_portraitBox:disabled{cursor:not-allowed}.rp_5ZMIxq_portraitAction{box-sizing:border-box;border-radius:0 0 var(--dsw-radius-lg) var(--dsw-radius-lg);color:#fff;text-align:center;opacity:0;background:#0000009e;padding:7px 6px;font-size:12px;line-height:16px;transition:opacity .12s;position:absolute;bottom:1px;left:1px;right:1px}.rp_5ZMIxq_portraitBox:hover .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:focus-visible .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:disabled .rp_5ZMIxq_portraitAction{opacity:1}.rp_5ZMIxq_portraitError,.rp_5ZMIxq_portraitHint{margin:12px 24px 0;font-size:12px}.rp_5ZMIxq_portraitError{color:var(--dsw-alias-state-danger-primary)}.rp_5ZMIxq_portraitHint{color:var(--dsw-alias-label-secondary)}.rp_5ZMIxq_placeholder{box-sizing:border-box;color:var(--dsw-alias-label-secondary);flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_initial{opacity:.6;font-size:48px;font-weight:500;line-height:1}.rp_5ZMIxq_missing{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_meta{flex-direction:column;flex:1 1 0;gap:10px;min-width:0;display:flex}.rp_5ZMIxq_section{border-top:.5px solid var(--dsw-alias-border-l4);flex-direction:column;gap:6px;padding-top:16px;display:flex}.rp_5ZMIxq_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:500;line-height:20px}.rp_5ZMIxq_empty{color:var(--dsw-alias-label-tertiary);margin:0;padding:0 24px;font-size:13px}.rp_5ZMIxq_section .rp_5ZMIxq_empty{padding:0}.rp_5ZMIxq_tabsSpace{flex:auto}.rp_5ZMIxq_voiceInline{min-width:220px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_5ZMIxq_bar{border-bottom:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-2);flex:none;justify-content:flex-end;align-items:center;gap:8px;padding:6px 24px;display:flex}.rp_5ZMIxq_barText{color:var(--dsw-alias-label-secondary);margin-right:auto;font-size:12px}.rp_5ZMIxq_nameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:var(--dsw-alias-label-primary);font:inherit;padding:4px 8px;font-size:14px;line-height:22px}.rp_5ZMIxq_row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_grid{grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:10px 12px;display:grid}.rp_5ZMIxq_field{flex-direction:column;gap:4px;min-width:0;display:flex}.rp_5ZMIxq_wide{grid-column:1/-1}.rp_5ZMIxq_label,.rp_5ZMIxq_help{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_error{color:var(--dsw-alias-state-error-primary);font-size:12px}.rp_5ZMIxq_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:4px 8px;font-size:13px}.rp_5ZMIxq_area{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:96px;color:inherit;font:inherit;resize:vertical;padding:6px 8px;font-size:13px;line-height:20px}.rp_5ZMIxq_goal{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);flex-direction:column;gap:8px;padding:10px;display:flex}.rp_5ZMIxq_row>.rp_5ZMIxq_select{width:auto;min-width:110px}.rp_5ZMIxq_select:focus-visible,.rp_5ZMIxq_area:focus-visible,.rp_5ZMIxq_nameInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}@media (width<=640px){.rp_5ZMIxq_sheet{padding-inline:16px}.rp_5ZMIxq_head{flex-direction:column}.rp_5ZMIxq_portraitBox,.rp_5ZMIxq_portrait{width:120px}.rp_5ZMIxq_portraitBox{flex-basis:120px;height:160px}.rp_5ZMIxq_bar{flex-wrap:wrap;padding-inline:16px}.rp_5ZMIxq_voiceInline{width:100%;min-width:0}}";
738
+ const key$24 = "src/client/world-editor/CharactersPanel.module.css";
739
+ let tag$24 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$24) + "]");
740
+ if (tag$24 === null) {
741
+ tag$24 = document.createElement("style");
742
+ tag$24.dataset.plugin = "@dsh-agentic-roleplay/core";
743
+ tag$24.dataset.pluginCss = key$24;
744
+ document.head.appendChild(tag$24);
745
745
  }
746
- tag$23.textContent = css$23;
746
+ tag$24.textContent = css$24;
747
747
  var CharactersPanel_module_css_default = {
748
- "tabs": "rp_5ZMIxq_tabs",
748
+ "section": "rp_5ZMIxq_section",
749
+ "bar": "rp_5ZMIxq_bar",
750
+ "meta": "rp_5ZMIxq_meta",
749
751
  "body": "rp_5ZMIxq_body",
750
- "portraitHint": "rp_5ZMIxq_portraitHint",
752
+ "placeholder": "rp_5ZMIxq_placeholder",
753
+ "missing": "rp_5ZMIxq_missing",
751
754
  "empty": "rp_5ZMIxq_empty",
752
- "voiceInline": "rp_5ZMIxq_voiceInline",
753
- "sectionTitle": "rp_5ZMIxq_sectionTitle",
754
- "meta": "rp_5ZMIxq_meta",
755
- "portrait": "rp_5ZMIxq_portrait",
756
755
  "help": "rp_5ZMIxq_help",
757
- "grid": "rp_5ZMIxq_grid",
758
- "initial": "rp_5ZMIxq_initial",
756
+ "voiceInline": "rp_5ZMIxq_voiceInline",
757
+ "wide": "rp_5ZMIxq_wide",
758
+ "error": "rp_5ZMIxq_error",
759
759
  "field": "rp_5ZMIxq_field",
760
- "placeholder": "rp_5ZMIxq_placeholder",
760
+ "initial": "rp_5ZMIxq_initial",
761
+ "area": "rp_5ZMIxq_area",
761
762
  "nameInput": "rp_5ZMIxq_nameInput",
762
- "bar": "rp_5ZMIxq_bar",
763
+ "head": "rp_5ZMIxq_head",
764
+ "select": "rp_5ZMIxq_select",
765
+ "portraitHint": "rp_5ZMIxq_portraitHint",
763
766
  "label": "rp_5ZMIxq_label",
764
- "portraitBox": "rp_5ZMIxq_portraitBox",
765
- "tabsSpace": "rp_5ZMIxq_tabsSpace",
766
- "area": "rp_5ZMIxq_area",
767
- "panel": "rp_5ZMIxq_panel",
767
+ "portrait": "rp_5ZMIxq_portrait",
768
+ "goal": "rp_5ZMIxq_goal",
769
+ "grid": "rp_5ZMIxq_grid",
768
770
  "row": "rp_5ZMIxq_row",
769
- "error": "rp_5ZMIxq_error",
770
771
  "sheet": "rp_5ZMIxq_sheet",
771
- "wide": "rp_5ZMIxq_wide",
772
- "tab": "rp_5ZMIxq_tab",
773
- "select": "rp_5ZMIxq_select",
774
- "goal": "rp_5ZMIxq_goal",
775
- "missing": "rp_5ZMIxq_missing",
776
- "barText": "rp_5ZMIxq_barText",
777
772
  "tabOn": "rp_5ZMIxq_tabOn",
778
- "head": "rp_5ZMIxq_head",
779
773
  "portraitAction": "rp_5ZMIxq_portraitAction",
774
+ "sectionTitle": "rp_5ZMIxq_sectionTitle",
775
+ "tabsSpace": "rp_5ZMIxq_tabsSpace",
776
+ "barText": "rp_5ZMIxq_barText",
777
+ "panel": "rp_5ZMIxq_panel",
780
778
  "portraitError": "rp_5ZMIxq_portraitError",
781
- "section": "rp_5ZMIxq_section"
779
+ "tab": "rp_5ZMIxq_tab",
780
+ "portraitBox": "rp_5ZMIxq_portraitBox",
781
+ "tabs": "rp_5ZMIxq_tabs"
782
782
  };
783
783
  //#endregion
784
784
  //#region src/client/world-editor/EditorTabs.tsx
@@ -2379,50 +2379,50 @@ window.__ModuleLoader__.load({
2379
2379
  }
2380
2380
  //#endregion
2381
2381
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/RelationsPanel.module.css.mjs
2382
- const css$22 = ".rp_7pEHTW_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex;position:relative}.rp_7pEHTW_toolbar{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:4px;padding:8px 16px;display:flex}.rp_7pEHTW_filter{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:4px 10px}.rp_7pEHTW_filterOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_filter:focus-visible,.rp_7pEHTW_edge:focus-visible,.rp_7pEHTW_graphEdge:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:-2px}.rp_7pEHTW_space{flex:1}.rp_7pEHTW_perspective{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_7pEHTW_perspective select{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);max-width:180px;min-height:32px;color:inherit;padding:4px 8px}.rp_7pEHTW_workspace{flex:1 1 0;grid-template-columns:minmax(220px,34%) minmax(320px,1fr);min-height:0;display:grid}.rp_7pEHTW_list{border-right:.5px solid var(--dsw-alias-border-l3);overflow-y:auto}.rp_7pEHTW_edge{border:0;border-bottom:.5px solid var(--dsw-alias-border-l4);width:100%;min-height:48px;color:inherit;text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:8px 16px;display:flex}.rp_7pEHTW_edgeOn{background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_edgeTitle{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.rp_7pEHTW_edgeKind{color:var(--dsw-alias-label-tertiary);font-size:11px}.rp_7pEHTW_empty{color:var(--dsw-alias-label-tertiary);padding:20px}.rp_7pEHTW_inspector{min-width:0;padding:24px 24px 240px;overflow-y:auto}.rp_7pEHTW_head h2{margin:0 0 8px;font-size:17px}.rp_7pEHTW_entities{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:6px;display:flex}.rp_7pEHTW_notice{color:var(--dsw-alias-label-secondary);margin:24px 0}.rp_7pEHTW_form{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:24px;display:grid}.rp_7pEHTW_form label{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:5px;font-size:12px;display:flex}.rp_7pEHTW_form select,.rp_7pEHTW_form textarea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:6px 8px}.rp_7pEHTW_form textarea{resize:vertical;min-height:96px}.rp_7pEHTW_form select:focus-visible,.rp_7pEHTW_form textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}.rp_7pEHTW_wide{grid-column:1/-1}.rp_7pEHTW_metrics{grid-column:1/-1;grid-template-columns:repeat(4,minmax(90px,1fr));gap:10px;display:grid}.rp_7pEHTW_check{align-self:end;align-items:center;min-height:32px;flex-direction:row!important}.rp_7pEHTW_actions{border-top:.5px solid var(--dsw-alias-border-l4);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;margin-top:28px;padding-top:12px;display:flex}.rp_7pEHTW_status{color:var(--dsw-alias-label-secondary);margin-right:auto}.rp_7pEHTW_error{color:var(--dsw-alias-state-error-primary);margin-right:auto}.rp_7pEHTW_graph{background:radial-gradient(circle, var(--dsw-alias-bg-layer-2), transparent 70%);flex:1 1 0;min-height:360px;position:relative;overflow:hidden}.rp_7pEHTW_graph svg{width:100%;height:100%;min-height:520px}.rp_7pEHTW_graphEdge{cursor:pointer;stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_graphEdge:hover,.rp_7pEHTW_graphEdgeOn{stroke:var(--dsw-alias-state-business-primary);stroke-width:4px}.rp_7pEHTW_node circle{fill:var(--dsw-alias-bg-layer-1);stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_node_character circle{fill:color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_location circle{fill:color-mix(in srgb, #4a9 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_item circle{fill:color-mix(in srgb, #c90 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_faction circle{fill:color-mix(in srgb, #96c 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node text{fill:var(--dsw-alias-label-primary);pointer-events:none;font-size:11px}.rp_7pEHTW_graphInspector{box-sizing:border-box;border-radius:var(--dsw-radius-panel);background:var(--dsw-alias-bg-layer-1);width:min(480px,100% - 40px);max-height:62%;box-shadow:var(--dsw-elevation-panel);border:0;padding:18px;position:absolute;bottom:20px;right:20px;overflow-y:auto}@media (width<=760px){.rp_7pEHTW_workspace{grid-template-columns:1fr}.rp_7pEHTW_list{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l3);max-height:220px}.rp_7pEHTW_inspector{padding-inline:16px}.rp_7pEHTW_form{grid-template-columns:1fr}.rp_7pEHTW_wide,.rp_7pEHTW_metrics{grid-column:1}.rp_7pEHTW_metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.rp_7pEHTW_graphInspector{width:calc(100% - 24px);bottom:12px;right:12px}}@media (pointer:coarse){.rp_7pEHTW_filter{min-height:44px}}";
2383
- const key$22 = "src/client/world-editor/RelationsPanel.module.css";
2384
- let tag$22 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$22) + "]");
2385
- if (tag$22 === null) {
2386
- tag$22 = document.createElement("style");
2387
- tag$22.dataset.plugin = "@dsh-agentic-roleplay/core";
2388
- tag$22.dataset.pluginCss = key$22;
2389
- document.head.appendChild(tag$22);
2382
+ const css$23 = ".rp_7pEHTW_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex;position:relative}.rp_7pEHTW_toolbar{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:4px;padding:8px 16px;display:flex}.rp_7pEHTW_filter{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:4px 10px}.rp_7pEHTW_filterOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_filter:focus-visible,.rp_7pEHTW_edge:focus-visible,.rp_7pEHTW_graphEdge:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:-2px}.rp_7pEHTW_space{flex:1}.rp_7pEHTW_perspective{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_7pEHTW_perspective select{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);max-width:180px;min-height:32px;color:inherit;padding:4px 8px}.rp_7pEHTW_workspace{flex:1 1 0;grid-template-columns:minmax(220px,34%) minmax(320px,1fr);min-height:0;display:grid}.rp_7pEHTW_list{border-right:.5px solid var(--dsw-alias-border-l3);overflow-y:auto}.rp_7pEHTW_edge{border:0;border-bottom:.5px solid var(--dsw-alias-border-l4);width:100%;min-height:48px;color:inherit;text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:8px 16px;display:flex}.rp_7pEHTW_edgeOn{background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_edgeTitle{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.rp_7pEHTW_edgeKind{color:var(--dsw-alias-label-tertiary);font-size:11px}.rp_7pEHTW_empty{color:var(--dsw-alias-label-tertiary);padding:20px}.rp_7pEHTW_inspector{min-width:0;padding:24px 24px 240px;overflow-y:auto}.rp_7pEHTW_head h2{margin:0 0 8px;font-size:17px}.rp_7pEHTW_entities{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:6px;display:flex}.rp_7pEHTW_notice{color:var(--dsw-alias-label-secondary);margin:24px 0}.rp_7pEHTW_form{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:24px;display:grid}.rp_7pEHTW_form label{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:5px;font-size:12px;display:flex}.rp_7pEHTW_form select,.rp_7pEHTW_form textarea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:6px 8px}.rp_7pEHTW_form textarea{resize:vertical;min-height:96px}.rp_7pEHTW_form select:focus-visible,.rp_7pEHTW_form textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}.rp_7pEHTW_wide{grid-column:1/-1}.rp_7pEHTW_metrics{grid-column:1/-1;grid-template-columns:repeat(4,minmax(90px,1fr));gap:10px;display:grid}.rp_7pEHTW_check{align-self:end;align-items:center;min-height:32px;flex-direction:row!important}.rp_7pEHTW_actions{border-top:.5px solid var(--dsw-alias-border-l4);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;margin-top:28px;padding-top:12px;display:flex}.rp_7pEHTW_status{color:var(--dsw-alias-label-secondary);margin-right:auto}.rp_7pEHTW_error{color:var(--dsw-alias-state-error-primary);margin-right:auto}.rp_7pEHTW_graph{background:radial-gradient(circle, var(--dsw-alias-bg-layer-2), transparent 70%);flex:1 1 0;min-height:360px;position:relative;overflow:hidden}.rp_7pEHTW_graph svg{width:100%;height:100%;min-height:520px}.rp_7pEHTW_graphEdge{cursor:pointer;stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_graphEdge:hover,.rp_7pEHTW_graphEdgeOn{stroke:var(--dsw-alias-state-business-primary);stroke-width:4px}.rp_7pEHTW_node circle{fill:var(--dsw-alias-bg-layer-1);stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_node_character circle{fill:color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_location circle{fill:color-mix(in srgb, #4a9 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_item circle{fill:color-mix(in srgb, #c90 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_faction circle{fill:color-mix(in srgb, #96c 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node text{fill:var(--dsw-alias-label-primary);pointer-events:none;font-size:11px}.rp_7pEHTW_graphInspector{box-sizing:border-box;border-radius:var(--dsw-radius-panel);background:var(--dsw-alias-bg-layer-1);width:min(480px,100% - 40px);max-height:62%;box-shadow:var(--dsw-elevation-panel);border:0;padding:18px;position:absolute;bottom:20px;right:20px;overflow-y:auto}@media (width<=760px){.rp_7pEHTW_workspace{grid-template-columns:1fr}.rp_7pEHTW_list{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l3);max-height:220px}.rp_7pEHTW_inspector{padding-inline:16px}.rp_7pEHTW_form{grid-template-columns:1fr}.rp_7pEHTW_wide,.rp_7pEHTW_metrics{grid-column:1}.rp_7pEHTW_metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.rp_7pEHTW_graphInspector{width:calc(100% - 24px);bottom:12px;right:12px}}@media (pointer:coarse){.rp_7pEHTW_filter{min-height:44px}}";
2383
+ const key$23 = "src/client/world-editor/RelationsPanel.module.css";
2384
+ let tag$23 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$23) + "]");
2385
+ if (tag$23 === null) {
2386
+ tag$23 = document.createElement("style");
2387
+ tag$23.dataset.plugin = "@dsh-agentic-roleplay/core";
2388
+ tag$23.dataset.pluginCss = key$23;
2389
+ document.head.appendChild(tag$23);
2390
2390
  }
2391
- tag$22.textContent = css$22;
2391
+ tag$23.textContent = css$23;
2392
2392
  var RelationsPanel_module_css_default = {
2393
+ "graphEdge": "rp_7pEHTW_graphEdge",
2393
2394
  "graphInspector": "rp_7pEHTW_graphInspector",
2394
- "head": "rp_7pEHTW_head",
2395
- "space": "rp_7pEHTW_space",
2396
- "filter": "rp_7pEHTW_filter",
2397
- "node_character": "rp_7pEHTW_node_character",
2398
- "metrics": "rp_7pEHTW_metrics",
2399
- "form": "rp_7pEHTW_form",
2400
- "status": "rp_7pEHTW_status",
2401
- "node_item": "rp_7pEHTW_node_item",
2402
- "toolbar": "rp_7pEHTW_toolbar",
2403
- "edge": "rp_7pEHTW_edge",
2404
- "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2395
+ "list": "rp_7pEHTW_list",
2396
+ "node_faction": "rp_7pEHTW_node_faction",
2405
2397
  "check": "rp_7pEHTW_check",
2406
2398
  "entities": "rp_7pEHTW_entities",
2407
- "graph": "rp_7pEHTW_graph",
2399
+ "wide": "rp_7pEHTW_wide",
2400
+ "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2401
+ "inspector": "rp_7pEHTW_inspector",
2408
2402
  "filterOn": "rp_7pEHTW_filterOn",
2409
- "graphEdge": "rp_7pEHTW_graphEdge",
2410
- "list": "rp_7pEHTW_list",
2403
+ "space": "rp_7pEHTW_space",
2404
+ "empty": "rp_7pEHTW_empty",
2411
2405
  "edgeKind": "rp_7pEHTW_edgeKind",
2406
+ "form": "rp_7pEHTW_form",
2407
+ "filter": "rp_7pEHTW_filter",
2412
2408
  "actions": "rp_7pEHTW_actions",
2413
- "error": "rp_7pEHTW_error",
2414
- "wide": "rp_7pEHTW_wide",
2409
+ "perspective": "rp_7pEHTW_perspective",
2415
2410
  "node_location": "rp_7pEHTW_node_location",
2416
- "edgeTitle": "rp_7pEHTW_edgeTitle",
2417
- "workspace": "rp_7pEHTW_workspace",
2418
2411
  "edgeOn": "rp_7pEHTW_edgeOn",
2419
- "perspective": "rp_7pEHTW_perspective",
2420
- "node_faction": "rp_7pEHTW_node_faction",
2421
- "empty": "rp_7pEHTW_empty",
2422
- "panel": "rp_7pEHTW_panel",
2423
- "inspector": "rp_7pEHTW_inspector",
2424
2412
  "node": "rp_7pEHTW_node",
2425
- "notice": "rp_7pEHTW_notice"
2413
+ "toolbar": "rp_7pEHTW_toolbar",
2414
+ "graph": "rp_7pEHTW_graph",
2415
+ "node_item": "rp_7pEHTW_node_item",
2416
+ "panel": "rp_7pEHTW_panel",
2417
+ "notice": "rp_7pEHTW_notice",
2418
+ "workspace": "rp_7pEHTW_workspace",
2419
+ "metrics": "rp_7pEHTW_metrics",
2420
+ "status": "rp_7pEHTW_status",
2421
+ "edgeTitle": "rp_7pEHTW_edgeTitle",
2422
+ "error": "rp_7pEHTW_error",
2423
+ "edge": "rp_7pEHTW_edge",
2424
+ "node_character": "rp_7pEHTW_node_character",
2425
+ "head": "rp_7pEHTW_head"
2426
2426
  };
2427
2427
  //#endregion
2428
2428
  //#region src/client/world-editor/RelationsPanel.tsx
@@ -3739,23 +3739,23 @@ window.__ModuleLoader__.load({
3739
3739
  };
3740
3740
  //#endregion
3741
3741
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/pack-frame/PackFrame.module.css.mjs
3742
- const css$21 = ".rp_h_sbFq_frame{background:0 0;border:0;width:100%;display:block}.rp_h_sbFq_fill{height:100%;min-height:0}.rp_h_sbFq_message{color:var(--dsw-alias-label-secondary);margin:0;padding:16px 24px;font-size:13px;line-height:20px}.rp_h_sbFq_problems{color:var(--dsw-alias-label-tertiary);margin:8px 0 0;padding-left:18px;font-size:12px}.rp_h_sbFq_hud{box-sizing:border-box;width:min(800px,100%);margin:0 auto 8px;padding:0 16px}.rp_h_sbFq_tab{flex-direction:column;flex:1 1 0;width:100%;min-height:0;display:flex}";
3743
- const key$21 = "src/client/widgets/pack-frame/PackFrame.module.css";
3744
- let tag$21 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$21) + "]");
3745
- if (tag$21 === null) {
3746
- tag$21 = document.createElement("style");
3747
- tag$21.dataset.plugin = "@dsh-agentic-roleplay/core";
3748
- tag$21.dataset.pluginCss = key$21;
3749
- document.head.appendChild(tag$21);
3742
+ const css$22 = ".rp_h_sbFq_frame{background:0 0;border:0;width:100%;display:block}.rp_h_sbFq_fill{height:100%;min-height:0}.rp_h_sbFq_message{color:var(--dsw-alias-label-secondary);margin:0;padding:16px 24px;font-size:13px;line-height:20px}.rp_h_sbFq_problems{color:var(--dsw-alias-label-tertiary);margin:8px 0 0;padding-left:18px;font-size:12px}.rp_h_sbFq_hud{box-sizing:border-box;width:min(800px,100%);margin:0 auto 8px;padding:0 16px}.rp_h_sbFq_tab{flex-direction:column;flex:1 1 0;width:100%;min-height:0;display:flex}";
3743
+ const key$22 = "src/client/widgets/pack-frame/PackFrame.module.css";
3744
+ let tag$22 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$22) + "]");
3745
+ if (tag$22 === null) {
3746
+ tag$22 = document.createElement("style");
3747
+ tag$22.dataset.plugin = "@dsh-agentic-roleplay/core";
3748
+ tag$22.dataset.pluginCss = key$22;
3749
+ document.head.appendChild(tag$22);
3750
3750
  }
3751
- tag$21.textContent = css$21;
3751
+ tag$22.textContent = css$22;
3752
3752
  var PackFrame_module_css_default = {
3753
- "fill": "rp_h_sbFq_fill",
3754
3753
  "problems": "rp_h_sbFq_problems",
3755
3754
  "message": "rp_h_sbFq_message",
3756
- "tab": "rp_h_sbFq_tab",
3755
+ "hud": "rp_h_sbFq_hud",
3757
3756
  "frame": "rp_h_sbFq_frame",
3758
- "hud": "rp_h_sbFq_hud"
3757
+ "tab": "rp_h_sbFq_tab",
3758
+ "fill": "rp_h_sbFq_fill"
3759
3759
  };
3760
3760
  //#endregion
3761
3761
  //#region src/client/widgets/pack-frame/theme.ts
@@ -3979,32 +3979,47 @@ window.__ModuleLoader__.load({
3979
3979
  };
3980
3980
  const loadRoutines = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/routines?${query(world)}`, init("GET", signal)));
3981
3981
  const saveRoutine = async (world, key, windows, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/routines/item?${query(world)}&key=${encodeURIComponent(key)}`, init("PUT", signal, { windows })));
3982
+ const loadDice = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/dice?${query(world)}`, init("GET", signal)));
3983
+ const saveDice = async (world, dice, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/dice?${query(world)}`, init("PUT", signal, dice)));
3982
3984
  const loadCalendar = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/calendar?${query(world)}`, init("GET", signal)));
3983
3985
  const saveCalendar = async (world, calendar, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/calendar?${query(world)}`, init("PUT", signal, calendar)));
3984
3986
  const loadVariables = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("GET", signal)));
3985
3987
  const saveVariables = async (world, variables, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("PUT", signal, { variables })));
3986
3988
  const loadWorldPacks = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface?${query(world)}`, init("GET", signal)));
3987
3989
  const loadPackPreview = async (world, pack, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface/preview?${query(world)}&pack=${encodeURIComponent(pack)}`, init("GET", signal)));
3990
+ /** The playable characters of an authored world, for choosing whom an opening is for. */
3991
+ async function loadPlayable(worldId, signal) {
3992
+ const response = await fetch(`${API_PREFIX}/worlds/characters?id=${encodeURIComponent(worldId)}`, {
3993
+ credentials: "same-origin",
3994
+ signal
3995
+ });
3996
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
3997
+ const { characters } = await response.json();
3998
+ return characters.filter((character) => character.role === "playable").map(({ id, name }) => ({
3999
+ id,
4000
+ name
4001
+ }));
4002
+ }
3988
4003
  //#endregion
3989
4004
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/PacksPanel.module.css.mjs
3990
- const css$20 = ".rp_FLaP7q_controls{flex-wrap:wrap;align-items:center;gap:8px 16px;margin:8px 0;display:flex}.rp_FLaP7q_group{color:var(--dsw-alias-label-tertiary);align-items:center;gap:4px;font-size:12px;display:inline-flex}.rp_FLaP7q_stage{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);max-width:100%;overflow:hidden}.rp_FLaP7q_stageTall{height:420px}.rp_FLaP7q_log{color:var(--dsw-alias-label-secondary);margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_files{columns:2 220px;margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_note{color:var(--dsw-alias-label-tertiary);font-size:12px}";
3991
- const key$20 = "src/client/world-editor/PacksPanel.module.css";
3992
- let tag$20 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$20) + "]");
3993
- if (tag$20 === null) {
3994
- tag$20 = document.createElement("style");
3995
- tag$20.dataset.plugin = "@dsh-agentic-roleplay/core";
3996
- tag$20.dataset.pluginCss = key$20;
3997
- document.head.appendChild(tag$20);
4005
+ const css$21 = ".rp_FLaP7q_controls{flex-wrap:wrap;align-items:center;gap:8px 16px;margin:8px 0;display:flex}.rp_FLaP7q_group{color:var(--dsw-alias-label-tertiary);align-items:center;gap:4px;font-size:12px;display:inline-flex}.rp_FLaP7q_stage{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);max-width:100%;overflow:hidden}.rp_FLaP7q_stageTall{height:420px}.rp_FLaP7q_log{color:var(--dsw-alias-label-secondary);margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_files{columns:2 220px;margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_note{color:var(--dsw-alias-label-tertiary);font-size:12px}";
4006
+ const key$21 = "src/client/world-editor/PacksPanel.module.css";
4007
+ let tag$21 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$21) + "]");
4008
+ if (tag$21 === null) {
4009
+ tag$21 = document.createElement("style");
4010
+ tag$21.dataset.plugin = "@dsh-agentic-roleplay/core";
4011
+ tag$21.dataset.pluginCss = key$21;
4012
+ document.head.appendChild(tag$21);
3998
4013
  }
3999
- tag$20.textContent = css$20;
4014
+ tag$21.textContent = css$21;
4000
4015
  var PacksPanel_module_css_default = {
4001
- "group": "rp_FLaP7q_group",
4002
- "controls": "rp_FLaP7q_controls",
4003
4016
  "note": "rp_FLaP7q_note",
4004
- "files": "rp_FLaP7q_files",
4005
- "stage": "rp_FLaP7q_stage",
4006
4017
  "stageTall": "rp_FLaP7q_stageTall",
4007
- "log": "rp_FLaP7q_log"
4018
+ "controls": "rp_FLaP7q_controls",
4019
+ "group": "rp_FLaP7q_group",
4020
+ "stage": "rp_FLaP7q_stage",
4021
+ "log": "rp_FLaP7q_log",
4022
+ "files": "rp_FLaP7q_files"
4008
4023
  };
4009
4024
  //#endregion
4010
4025
  //#region src/client/world-editor/PacksPanel.tsx
@@ -4443,7 +4458,7 @@ window.__ModuleLoader__.load({
4443
4458
  }
4444
4459
  //#endregion
4445
4460
  //#region src/client/world-editor/InfoPanel.tsx
4446
- const draftOf$2 = (info) => ({
4461
+ const draftOf$3 = (info) => ({
4447
4462
  name: info.name,
4448
4463
  description: info.description,
4449
4464
  tags: info.tags.join(", "),
@@ -4475,7 +4490,8 @@ window.__ModuleLoader__.load({
4475
4490
  if (JSON.stringify(lines(draft.rules)) !== JSON.stringify(lines(saved.rules))) edit["rules"] = lines(draft.rules);
4476
4491
  const cleaned = (list) => list.map((entry) => ({
4477
4492
  title: entry.title.trim(),
4478
- text: entry.text.trim()
4493
+ text: entry.text.trim(),
4494
+ ...(entry.character ?? "") === "" ? {} : { character: entry.character }
4479
4495
  })).filter((entry) => entry.text !== "");
4480
4496
  if (JSON.stringify(cleaned(draft.alternates)) !== JSON.stringify(cleaned(saved.alternates))) edit["alternateOpenings"] = cleaned(draft.alternates);
4481
4497
  return edit;
@@ -4486,12 +4502,20 @@ window.__ModuleLoader__.load({
4486
4502
  const [saved, setSaved] = (0, react.useState)();
4487
4503
  const [draft, setDraft] = (0, react.useState)();
4488
4504
  const [status, setStatus] = (0, react.useState)({ state: "idle" });
4505
+ const [playable, setPlayable] = (0, react.useState)([]);
4506
+ (0, react.useEffect)(() => {
4507
+ const abort = new AbortController();
4508
+ loadPlayable(worldId, abort.signal).then(setPlayable, () => void 0);
4509
+ return () => {
4510
+ abort.abort();
4511
+ };
4512
+ }, [worldId]);
4489
4513
  (0, react.useEffect)(() => {
4490
4514
  const abort = new AbortController();
4491
4515
  loadInfo(worldId, abort.signal).then((value) => {
4492
4516
  setInfo(value);
4493
- setSaved(draftOf$2(value));
4494
- setDraft(draftOf$2(value));
4517
+ setSaved(draftOf$3(value));
4518
+ setDraft(draftOf$3(value));
4495
4519
  }, (failure) => {
4496
4520
  if (!abort.signal.aborted) setStatus({
4497
4521
  state: "failed",
@@ -4527,8 +4551,8 @@ window.__ModuleLoader__.load({
4527
4551
  setStatus({ state: "saving" });
4528
4552
  saveInfo(worldId, edit, new AbortController().signal).then((value) => {
4529
4553
  setInfo(value);
4530
- setSaved(draftOf$2(value));
4531
- setDraft(draftOf$2(value));
4554
+ setSaved(draftOf$3(value));
4555
+ setDraft(draftOf$3(value));
4532
4556
  setStatus({ state: "saved" });
4533
4557
  onSaved();
4534
4558
  }, (failure) => {
@@ -4671,6 +4695,36 @@ window.__ModuleLoader__.load({
4671
4695
  }
4672
4696
  })]
4673
4697
  }),
4698
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4699
+ className: CharactersPanel_module_css_default.field,
4700
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4701
+ className: CharactersPanel_module_css_default.label,
4702
+ children: t("infoAlternateFor")
4703
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4704
+ className: CharactersPanel_module_css_default.select,
4705
+ value: entry.character ?? "",
4706
+ onChange: (event) => {
4707
+ setAlternates(draft.alternates.map((item, at) => at === index ? {
4708
+ ...item,
4709
+ character: event.target.value
4710
+ } : item));
4711
+ },
4712
+ children: [
4713
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4714
+ value: "",
4715
+ children: t("infoAlternateAny")
4716
+ }),
4717
+ playable.map((character) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4718
+ value: character.id,
4719
+ children: character.name
4720
+ }, character.id)),
4721
+ entry.character !== void 0 && entry.character !== "" && !playable.some((character) => character.id === entry.character) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4722
+ value: entry.character,
4723
+ children: entry.character
4724
+ })
4725
+ ]
4726
+ })]
4727
+ }),
4674
4728
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4675
4729
  variant: "ghost",
4676
4730
  size: "sm",
@@ -5253,7 +5307,7 @@ window.__ModuleLoader__.load({
5253
5307
  }
5254
5308
  //#endregion
5255
5309
  //#region src/client/world-editor/CalendarPanel.tsx
5256
- const draftOf$1 = (calendar) => ({
5310
+ const draftOf$2 = (calendar) => ({
5257
5311
  hemisphere: calendar.hemisphere,
5258
5312
  holidays: calendar.holidays.map((holiday) => ({
5259
5313
  id: holiday.id,
@@ -5261,7 +5315,7 @@ window.__ModuleLoader__.load({
5261
5315
  on: holiday.on.join(", ")
5262
5316
  }))
5263
5317
  });
5264
- const documentOf = (draft) => ({
5318
+ const documentOf$1 = (draft) => ({
5265
5319
  hemisphere: draft.hemisphere,
5266
5320
  holidays: draft.holidays.map((holiday) => ({
5267
5321
  id: holiday.id.trim(),
@@ -5280,7 +5334,7 @@ window.__ModuleLoader__.load({
5280
5334
  (0, react.useEffect)(() => {
5281
5335
  const abort = new AbortController();
5282
5336
  loadCalendar(worldId, abort.signal).then((value) => {
5283
- const next = draftOf$1(value);
5337
+ const next = draftOf$2(value);
5284
5338
  setSaved(next);
5285
5339
  setDraft(next);
5286
5340
  }, (failure) => {
@@ -5298,7 +5352,7 @@ window.__ModuleLoader__.load({
5298
5352
  role: status.state === "failed" ? "alert" : void 0,
5299
5353
  children: status.state === "failed" ? t("saveFailed", { message: status.message ?? "" }) : t("editorLoading")
5300
5354
  });
5301
- const dirty = JSON.stringify(documentOf(draft)) !== JSON.stringify(documentOf(saved));
5355
+ const dirty = JSON.stringify(documentOf$1(draft)) !== JSON.stringify(documentOf$1(saved));
5302
5356
  const change = (next) => {
5303
5357
  setDraft(next);
5304
5358
  setStatus({ state: "idle" });
@@ -5314,8 +5368,8 @@ window.__ModuleLoader__.load({
5314
5368
  };
5315
5369
  const save = () => {
5316
5370
  setStatus({ state: "saving" });
5317
- saveCalendar(worldId, documentOf(draft), new AbortController().signal).then((value) => {
5318
- const next = draftOf$1(value);
5371
+ saveCalendar(worldId, documentOf$1(draft), new AbortController().signal).then((value) => {
5372
+ const next = draftOf$2(value);
5319
5373
  setSaved(next);
5320
5374
  setDraft(next);
5321
5375
  setStatus({ state: "saved" });
@@ -5460,53 +5514,768 @@ window.__ModuleLoader__.load({
5460
5514
  });
5461
5515
  }
5462
5516
  //#endregion
5463
- //#region src/client/world-editor/variables-draft.ts
5464
- const list = (value) => value.split(/[,,\n]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
5465
- const NEW = {
5466
- key: "",
5467
- name: "",
5468
- kind: "number",
5469
- subject: "character",
5470
- visibility: "public",
5471
- description: "",
5472
- min: "",
5473
- max: "",
5474
- integer: false,
5475
- baseline: false,
5476
- always: false,
5477
- default: "",
5478
- only: "",
5479
- options: "",
5480
- bands: ""
5481
- };
5482
- const draftOf = (value) => ({
5483
- key: value.key,
5484
- name: value.name,
5485
- kind: value.kind,
5486
- subject: value.subject,
5487
- visibility: value.visibility,
5488
- description: value.description ?? "",
5489
- min: value.min === void 0 ? "" : String(value.min),
5490
- max: value.max === void 0 ? "" : String(value.max),
5491
- integer: value.integer === true,
5492
- baseline: value.baseline === true,
5493
- always: value.always === true,
5494
- default: value.default === void 0 ? "" : String(value.default),
5495
- only: (value.only ?? []).join(", "),
5496
- options: (value.options ?? []).join(", "),
5497
- bands: (value.bands ?? []).map((band) => `${band.up_to}: ${band.label}`).join("\n")
5498
- });
5499
- /** The declaration as it will be sent: a default is a number, true/false or text according to the kind; bands are `up to: label` lines. */
5500
- function declarationOf(draft) {
5501
- const number = (text) => text.trim() === "" || !Number.isFinite(Number(text)) ? void 0 : Number(text);
5502
- const defaultValue = draft.default.trim() === "" ? void 0 : draft.kind === "number" ? number(draft.default) ?? draft.default.trim() : draft.kind === "flag" ? draft.default.trim() === "true" : draft.default.trim();
5503
- const bands = draft.bands.split("\n").flatMap((line) => {
5504
- const at = line.indexOf(":");
5505
- const upTo = at < 0 ? void 0 : number(line.slice(0, at));
5506
- return upTo === void 0 ? [] : [{
5507
- up_to: upTo,
5508
- label: line.slice(at + 1).trim()
5509
- }];
5517
+ //#region src/client/widgets/tool-switches/tools-api.ts
5518
+ /** The tools other plugins registered for everyone (a file or shell tool, an MCP server's), which an agent can be given. */
5519
+ async function loadExternalTools(signal) {
5520
+ const response = await fetch(`${API_PREFIX}/tools`, {
5521
+ credentials: "same-origin",
5522
+ signal
5523
+ });
5524
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
5525
+ return (await response.json()).tools ?? [];
5526
+ }
5527
+ //#endregion
5528
+ //#region src/shared/tools.ts
5529
+ /** The kinds of agent whose tools can be chosen. A character is not one agent but a kind: the choice is for all of them. */
5530
+ const AGENT_KINDS = [
5531
+ "gameMaster",
5532
+ "characters",
5533
+ "records"
5534
+ ];
5535
+ /** What this version can offer. A name in a settings file or a world that is not here is kept and ignored. */
5536
+ const OPTIONAL_TOOLS = [
5537
+ {
5538
+ id: "roll_check",
5539
+ agent: "gameMaster",
5540
+ default: true
5541
+ },
5542
+ {
5543
+ id: "roll_dice",
5544
+ agent: "gameMaster",
5545
+ default: true
5546
+ },
5547
+ {
5548
+ id: "list_checks",
5549
+ agent: "gameMaster",
5550
+ default: true
5551
+ },
5552
+ {
5553
+ id: "recall_my_memories",
5554
+ agent: "characters",
5555
+ default: true
5556
+ },
5557
+ {
5558
+ id: "recall_my_known_entities",
5559
+ agent: "characters",
5560
+ default: true
5561
+ },
5562
+ {
5563
+ id: "recall_my_lore",
5564
+ agent: "characters",
5565
+ default: true
5566
+ },
5567
+ {
5568
+ id: "search_events",
5569
+ agent: "records",
5570
+ default: true
5571
+ },
5572
+ {
5573
+ id: "list_threads",
5574
+ agent: "records",
5575
+ default: true
5576
+ },
5577
+ {
5578
+ id: "list_relationships",
5579
+ agent: "records",
5580
+ default: true
5581
+ },
5582
+ {
5583
+ id: "list_items",
5584
+ agent: "records",
5585
+ default: true
5586
+ }
5587
+ ];
5588
+ /** Whether an agent of this kind has a tool, by what the switches say and, failing that, by default. A tool this version does not offer is never on. */
5589
+ function toolEnabled(board, agent, id) {
5590
+ const offered = OPTIONAL_TOOLS.find((tool) => tool.agent === agent && tool.id === id);
5591
+ if (offered === void 0) return false;
5592
+ return board[agent]?.[id] ?? offered.default;
5593
+ }
5594
+ /** The tools this version offers for each kind of agent, as the switches stand; names it does not know are left out. */
5595
+ function switchesOf(board) {
5596
+ return AGENT_KINDS.map((agent) => ({
5597
+ agent,
5598
+ tools: OPTIONAL_TOOLS.filter((tool) => tool.agent === agent).map((tool) => ({
5599
+ id: tool.id,
5600
+ enabled: toolEnabled(board, agent, tool.id),
5601
+ default: tool.default
5602
+ }))
5603
+ }));
5604
+ }
5605
+ /**
5606
+ * The switches after one is set. Names this version does not know stay as they were, and a switch set to what the tool is by default is dropped,
5607
+ * so that a settings file says only what was chosen.
5608
+ */
5609
+ function withSwitch(board, agent, id, enabled) {
5610
+ const offered = OPTIONAL_TOOLS.find((tool) => tool.agent === agent && tool.id === id);
5611
+ if (offered === void 0) throw new Error(`there is no tool "${id}" to switch for ${agent}`);
5612
+ const mine = { ...board[agent] };
5613
+ if (enabled === offered.default) delete mine[id];
5614
+ else mine[id] = enabled;
5615
+ const next = {
5616
+ ...board,
5617
+ [agent]: mine
5618
+ };
5619
+ if (Object.keys(mine).length === 0) delete next[agent];
5620
+ return next;
5621
+ }
5622
+ /**
5623
+ * Whether an agent of this kind has a tool that is not one of this plugin's own: only when it was switched on. Such tools are off by default, because
5624
+ * they reach beyond the story (files, a shell, the web), and a name that no plugin registers now has no effect.
5625
+ */
5626
+ function externalEnabled(board, agent, name) {
5627
+ return board[agent]?.[name] === true;
5628
+ }
5629
+ /** The switches after an external tool is switched: only what is on is kept, so that a settings file says only what was chosen. */
5630
+ function withExternal(board, agent, name, enabled) {
5631
+ const mine = { ...board[agent] };
5632
+ if (enabled) mine[name] = true;
5633
+ else delete mine[name];
5634
+ const next = {
5635
+ ...board,
5636
+ [agent]: mine
5637
+ };
5638
+ if (Object.keys(mine).length === 0) delete next[agent];
5639
+ return next;
5640
+ }
5641
+ //#endregion
5642
+ //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/tool-switches/ToolSwitches.module.css.mjs
5643
+ const css$20 = ".rp_CjoFLq_root{flex-direction:column;gap:12px;display:flex}.rp_CjoFLq_title{margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_CjoFLq_help{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_CjoFLq_agent{border-top:1px solid var(--dsw-alias-border-l3);flex-direction:column;gap:6px;padding:8px 0;display:flex}.rp_CjoFLq_agentName{font-size:14px;font-weight:500}.rp_CjoFLq_hint{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_CjoFLq_tool{cursor:pointer;align-items:flex-start;gap:8px;font-size:13px;display:flex}.rp_CjoFLq_tool input{margin-top:3px}.rp_CjoFLq_toolText{flex-direction:column;display:flex}.rp_CjoFLq_default{color:var(--dsw-alias-label-tertiary);margin-left:6px;font-size:11px}.rp_CjoFLq_error{color:var(--dsw-alias-state-error-primary,#d33);font-size:12px}.rp_CjoFLq_external{flex-direction:column;gap:6px;margin-top:4px;display:flex}.rp_CjoFLq_external>summary{cursor:pointer}";
5644
+ const key$20 = "src/client/widgets/tool-switches/ToolSwitches.module.css";
5645
+ let tag$20 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$20) + "]");
5646
+ if (tag$20 === null) {
5647
+ tag$20 = document.createElement("style");
5648
+ tag$20.dataset.plugin = "@dsh-agentic-roleplay/core";
5649
+ tag$20.dataset.pluginCss = key$20;
5650
+ document.head.appendChild(tag$20);
5651
+ }
5652
+ tag$20.textContent = css$20;
5653
+ var ToolSwitches_module_css_default = {
5654
+ "default": "rp_CjoFLq_default",
5655
+ "external": "rp_CjoFLq_external",
5656
+ "title": "rp_CjoFLq_title",
5657
+ "agentName": "rp_CjoFLq_agentName",
5658
+ "toolText": "rp_CjoFLq_toolText",
5659
+ "tool": "rp_CjoFLq_tool",
5660
+ "error": "rp_CjoFLq_error",
5661
+ "root": "rp_CjoFLq_root",
5662
+ "agent": "rp_CjoFLq_agent",
5663
+ "hint": "rp_CjoFLq_hint",
5664
+ "help": "rp_CjoFLq_help"
5665
+ };
5666
+ //#endregion
5667
+ //#region src/client/widgets/tool-switches/ToolSwitches.tsx
5668
+ /**
5669
+ * The optional tools of each kind of agent, each a switch. It shows only the tools this version offers: names in the board it does not know
5670
+ * stay in it untouched, so that what a world or a settings file carries from another version survives a change made here.
5671
+ */
5672
+ function ToolSwitches({ board, onChange, disabled, error, external = [], t }) {
5673
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5674
+ className: ToolSwitches_module_css_default.root,
5675
+ "data-testid": "roleplay-tool-switches",
5676
+ "data-rp": "tool-switches",
5677
+ children: [
5678
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
5679
+ className: ToolSwitches_module_css_default.title,
5680
+ children: t("sw_title")
5681
+ }),
5682
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5683
+ className: ToolSwitches_module_css_default.help,
5684
+ children: t("sw_help")
5685
+ }),
5686
+ error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5687
+ className: ToolSwitches_module_css_default.error,
5688
+ role: "alert",
5689
+ children: t("sw_failed", { message: error })
5690
+ }),
5691
+ switchesOf(board).map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5692
+ className: ToolSwitches_module_css_default.agent,
5693
+ "data-agent": entry.agent,
5694
+ children: [
5695
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5696
+ className: ToolSwitches_module_css_default.agentName,
5697
+ children: t(`sw_agent_${entry.agent}`)
5698
+ }),
5699
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5700
+ className: ToolSwitches_module_css_default.hint,
5701
+ children: t(`sw_agent_${entry.agent}_hint`)
5702
+ }),
5703
+ entry.tools.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5704
+ className: ToolSwitches_module_css_default.hint,
5705
+ children: t("sw_none")
5706
+ }),
5707
+ entry.tools.map((tool) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5708
+ className: ToolSwitches_module_css_default.tool,
5709
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5710
+ type: "checkbox",
5711
+ checked: tool.enabled,
5712
+ disabled,
5713
+ "data-tool": tool.id,
5714
+ onChange: (event) => {
5715
+ onChange(withSwitch(board, entry.agent, tool.id, event.target.checked));
5716
+ }
5717
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5718
+ className: ToolSwitches_module_css_default.toolText,
5719
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [t(`sw_tool_${tool.id}`), tool.default ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5720
+ className: ToolSwitches_module_css_default.default,
5721
+ children: t("sw_default")
5722
+ }) : null] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5723
+ className: ToolSwitches_module_css_default.hint,
5724
+ children: t(`sw_tool_${tool.id}_hint`)
5725
+ })]
5726
+ })]
5727
+ }, tool.id)),
5728
+ external.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
5729
+ className: ToolSwitches_module_css_default.external,
5730
+ "data-testid": "roleplay-external-tools",
5731
+ children: [
5732
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
5733
+ className: ToolSwitches_module_css_default.hint,
5734
+ children: t("sw_external", {
5735
+ count: String(external.length),
5736
+ on: String(external.filter((tool) => externalEnabled(board, entry.agent, tool.name)).length)
5737
+ })
5738
+ }),
5739
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5740
+ className: ToolSwitches_module_css_default.hint,
5741
+ children: t("sw_external_help")
5742
+ }),
5743
+ external.map((tool) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5744
+ className: ToolSwitches_module_css_default.tool,
5745
+ title: tool.description,
5746
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5747
+ type: "checkbox",
5748
+ checked: externalEnabled(board, entry.agent, tool.name),
5749
+ disabled,
5750
+ "data-external": tool.name,
5751
+ onChange: (event) => {
5752
+ onChange(withExternal(board, entry.agent, tool.name, event.target.checked));
5753
+ }
5754
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5755
+ className: ToolSwitches_module_css_default.toolText,
5756
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tool.name }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5757
+ className: ToolSwitches_module_css_default.hint,
5758
+ children: tool.description.length > 140 ? `${tool.description.slice(0, 140)}…` : tool.description
5759
+ })]
5760
+ })]
5761
+ }, tool.name))
5762
+ ]
5763
+ })
5764
+ ]
5765
+ }, entry.agent)),
5766
+ external.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5767
+ className: ToolSwitches_module_css_default.hint,
5768
+ children: t("sw_external_none")
5769
+ })
5770
+ ]
5771
+ });
5772
+ }
5773
+ //#endregion
5774
+ //#region src/client/world-editor/ToolsPanel.tsx
5775
+ /** The optional tools the world's agents have, kept in `world.json` and given to every story started from the world; a story can change them for itself later. */
5776
+ function ToolsPanel({ t, worldId, actions }) {
5777
+ const [board, setBoard] = (0, react.useState)();
5778
+ const [external, setExternal] = (0, react.useState)([]);
5779
+ const [busy, setBusy] = (0, react.useState)(false);
5780
+ const [error, setError] = (0, react.useState)();
5781
+ (0, react.useEffect)(() => {
5782
+ const abort = new AbortController();
5783
+ loadInfo(worldId, abort.signal).then((info) => {
5784
+ setBoard(info.tools);
5785
+ }, (failure) => {
5786
+ if (!abort.signal.aborted) setError(failure instanceof Error ? failure.message : String(failure));
5787
+ });
5788
+ loadExternalTools(abort.signal).then(setExternal, () => void 0);
5789
+ return () => {
5790
+ abort.abort();
5791
+ };
5792
+ }, [worldId]);
5793
+ if (board === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5794
+ className: CharactersPanel_module_css_default.empty,
5795
+ role: error === void 0 ? void 0 : "alert",
5796
+ children: error === void 0 ? t("editorLoading") : t("saveFailed", { message: error })
5797
+ });
5798
+ const change = (next) => {
5799
+ setBusy(true);
5800
+ setError(void 0);
5801
+ saveInfo(worldId, { tools: next }, new AbortController().signal).then((info) => {
5802
+ setBoard(info.tools);
5803
+ }, (failure) => {
5804
+ setError(failure instanceof Error ? failure.message : String(failure));
5805
+ }).finally(() => {
5806
+ setBusy(false);
5807
+ });
5808
+ };
5809
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5810
+ className: CharactersPanel_module_css_default.panel,
5811
+ "data-testid": "roleplay-world-tools",
5812
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5813
+ className: CharactersPanel_module_css_default.tabs,
5814
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }), actions]
5815
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5816
+ className: CharactersPanel_module_css_default.body,
5817
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("article", {
5818
+ className: CharactersPanel_module_css_default.sheet,
5819
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolSwitches, {
5820
+ board,
5821
+ onChange: change,
5822
+ disabled: busy,
5823
+ external,
5824
+ ...error === void 0 ? {} : { error },
5825
+ t
5826
+ })
5827
+ })
5828
+ })]
5829
+ });
5830
+ }
5831
+ //#endregion
5832
+ //#region src/client/world-editor/DicePanel.tsx
5833
+ const draftOf$1 = (dice) => dice.checks.map((check) => ({
5834
+ key: check.key,
5835
+ name: check.name,
5836
+ use: check.use,
5837
+ dice: check.dice,
5838
+ reading: check.reading ?? "total",
5839
+ hit: check.hit === void 0 ? "" : String(check.hit),
5840
+ compare: check.compare ?? "absolute",
5841
+ modifier: check.modifier ?? "",
5842
+ bands: check.bands.map((band) => ({
5843
+ min: band.min === void 0 ? "" : String(band.min),
5844
+ max: band.max === void 0 ? "" : String(band.max),
5845
+ label: band.label,
5846
+ result: band.result,
5847
+ critical: band.critical === true
5848
+ }))
5849
+ }));
5850
+ const number = (text) => text.trim() === "" || !Number.isFinite(Number(text)) ? void 0 : Number(text);
5851
+ const documentOf = (drafts) => ({ checks: drafts.map((check) => ({
5852
+ key: check.key.trim(),
5853
+ name: check.name.trim(),
5854
+ use: check.use.trim(),
5855
+ dice: check.dice.trim(),
5856
+ ...check.reading === "total" ? {} : { reading: check.reading },
5857
+ ...check.reading === "successes" && number(check.hit) !== void 0 ? { hit: number(check.hit) } : {},
5858
+ ...check.compare === "absolute" ? {} : { compare: check.compare },
5859
+ ...check.modifier.trim() === "" ? {} : { modifier: check.modifier.trim() },
5860
+ bands: check.bands.map((band) => ({
5861
+ label: band.label.trim(),
5862
+ result: band.result,
5863
+ ...number(band.min) === void 0 ? {} : { min: number(band.min) },
5864
+ ...number(band.max) === void 0 ? {} : { max: number(band.max) },
5865
+ ...band.critical ? { critical: true } : {}
5866
+ }))
5867
+ })) });
5868
+ const blankBand = () => ({
5869
+ min: "",
5870
+ max: "",
5871
+ label: "",
5872
+ result: "succeeded",
5873
+ critical: false
5874
+ });
5875
+ const blankCheck = () => ({
5876
+ key: "",
5877
+ name: "",
5878
+ use: "",
5879
+ dice: "1d20",
5880
+ reading: "total",
5881
+ hit: "",
5882
+ compare: "absolute",
5883
+ modifier: "",
5884
+ bands: [blankBand()]
5885
+ });
5886
+ /** The dice checks of a world: what each is used for, the dice it rolls and the bands that say what a roll means. */
5887
+ function DicePanel({ t, worldId, actions }) {
5888
+ const [saved, setSaved] = (0, react.useState)();
5889
+ const [draft, setDraft] = (0, react.useState)([]);
5890
+ const [status, setStatus] = (0, react.useState)({ state: "idle" });
5891
+ (0, react.useEffect)(() => {
5892
+ const abort = new AbortController();
5893
+ loadDice(worldId, abort.signal).then((value) => {
5894
+ const next = draftOf$1(value);
5895
+ setSaved(next);
5896
+ setDraft(next);
5897
+ }, (failure) => {
5898
+ if (!abort.signal.aborted) setStatus({
5899
+ state: "failed",
5900
+ message: failure instanceof Error ? failure.message : String(failure)
5901
+ });
5902
+ });
5903
+ return () => {
5904
+ abort.abort();
5905
+ };
5906
+ }, [worldId]);
5907
+ if (saved === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5908
+ className: CharactersPanel_module_css_default.empty,
5909
+ role: status.state === "failed" ? "alert" : void 0,
5910
+ children: status.state === "failed" ? t("saveFailed", { message: status.message ?? "" }) : t("editorLoading")
5911
+ });
5912
+ const dirty = JSON.stringify(documentOf(draft)) !== JSON.stringify(documentOf(saved));
5913
+ const change = (next) => {
5914
+ setDraft(next);
5915
+ setStatus({ state: "idle" });
5916
+ };
5917
+ const patch = (index, fields) => {
5918
+ change(draft.map((entry, at) => at === index ? {
5919
+ ...entry,
5920
+ ...fields
5921
+ } : entry));
5922
+ };
5923
+ const patchBand = (index, band, fields) => {
5924
+ patch(index, { bands: draft[index].bands.map((entry, at) => at === band ? {
5925
+ ...entry,
5926
+ ...fields
5927
+ } : entry) });
5928
+ };
5929
+ const save = () => {
5930
+ setStatus({ state: "saving" });
5931
+ saveDice(worldId, documentOf(draft), new AbortController().signal).then((value) => {
5932
+ const next = draftOf$1(value);
5933
+ setSaved(next);
5934
+ setDraft(next);
5935
+ setStatus({ state: "saved" });
5936
+ }, (failure) => {
5937
+ setStatus({
5938
+ state: "failed",
5939
+ message: failure instanceof Error ? failure.message : String(failure)
5940
+ });
5941
+ });
5942
+ };
5943
+ const text = (index, key, label, help) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5944
+ className: CharactersPanel_module_css_default.field,
5945
+ children: [
5946
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5947
+ className: CharactersPanel_module_css_default.label,
5948
+ children: t(label)
5949
+ }),
5950
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5951
+ className: CharactersPanel_module_css_default.nameInput,
5952
+ value: draft[index][key],
5953
+ onChange: (event) => {
5954
+ patch(index, { [key]: event.target.value });
5955
+ }
5956
+ }),
5957
+ help !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5958
+ className: CharactersPanel_module_css_default.help,
5959
+ children: t(help)
5960
+ })
5961
+ ]
5962
+ });
5963
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5964
+ className: CharactersPanel_module_css_default.panel,
5965
+ "data-testid": "roleplay-dice-editor",
5966
+ children: [
5967
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5968
+ className: CharactersPanel_module_css_default.tabs,
5969
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }), actions]
5970
+ }),
5971
+ (dirty || status.state !== "idle") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5972
+ className: CharactersPanel_module_css_default.bar,
5973
+ role: "status",
5974
+ children: [
5975
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5976
+ className: status.state === "failed" ? CharactersPanel_module_css_default.error : CharactersPanel_module_css_default.barText,
5977
+ children: status.state === "failed" ? t("saveFailed", { message: status.message ?? "" }) : dirty ? t("unsaved") : t("saved")
5978
+ }),
5979
+ dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5980
+ variant: "ghost",
5981
+ size: "sm",
5982
+ onClick: () => {
5983
+ setDraft(saved);
5984
+ setStatus({ state: "idle" });
5985
+ },
5986
+ children: t("reset")
5987
+ }),
5988
+ dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5989
+ variant: "primary",
5990
+ size: "sm",
5991
+ disabled: status.state === "saving",
5992
+ onClick: save,
5993
+ children: status.state === "saving" ? t("saving") : t("save")
5994
+ })
5995
+ ]
5996
+ }),
5997
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5998
+ className: CharactersPanel_module_css_default.body,
5999
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
6000
+ className: CharactersPanel_module_css_default.sheet,
6001
+ children: [
6002
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6003
+ className: CharactersPanel_module_css_default.help,
6004
+ children: t("dice_help")
6005
+ }),
6006
+ draft.map((check, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
6007
+ className: CharactersPanel_module_css_default.section,
6008
+ "data-testid": "roleplay-dice-check",
6009
+ children: [
6010
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6011
+ className: CharactersPanel_module_css_default.grid,
6012
+ children: [
6013
+ text(index, "key", "dice_key"),
6014
+ text(index, "name", "dice_name"),
6015
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6016
+ className: `${CharactersPanel_module_css_default.field} ${CharactersPanel_module_css_default.wide}`,
6017
+ children: [
6018
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6019
+ className: CharactersPanel_module_css_default.label,
6020
+ children: t("dice_use")
6021
+ }),
6022
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
6023
+ className: CharactersPanel_module_css_default.nameInput,
6024
+ rows: 2,
6025
+ value: check.use,
6026
+ onChange: (event) => {
6027
+ patch(index, { use: event.target.value });
6028
+ }
6029
+ }),
6030
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6031
+ className: CharactersPanel_module_css_default.help,
6032
+ children: t("dice_useHelp")
6033
+ })
6034
+ ]
6035
+ }),
6036
+ text(index, "dice", "dice_dice", "dice_diceHelp"),
6037
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6038
+ className: CharactersPanel_module_css_default.field,
6039
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6040
+ className: CharactersPanel_module_css_default.label,
6041
+ children: t("dice_reading")
6042
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6043
+ value: check.reading,
6044
+ onChange: (event) => {
6045
+ patch(index, { reading: event.target.value });
6046
+ },
6047
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6048
+ value: "total",
6049
+ children: t("dice_readTotal")
6050
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6051
+ value: "successes",
6052
+ children: t("dice_readSuccesses")
6053
+ })]
6054
+ })]
6055
+ }),
6056
+ check.reading === "successes" && text(index, "hit", "dice_hit"),
6057
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6058
+ className: CharactersPanel_module_css_default.field,
6059
+ children: [
6060
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6061
+ className: CharactersPanel_module_css_default.label,
6062
+ children: t("dice_compare")
6063
+ }),
6064
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6065
+ value: check.compare,
6066
+ onChange: (event) => {
6067
+ patch(index, { compare: event.target.value });
6068
+ },
6069
+ children: [
6070
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6071
+ value: "absolute",
6072
+ children: t("dice_compareAbsolute")
6073
+ }),
6074
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6075
+ value: "over",
6076
+ children: t("dice_compareOver")
6077
+ }),
6078
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6079
+ value: "under",
6080
+ children: t("dice_compareUnder")
6081
+ })
6082
+ ]
6083
+ }),
6084
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6085
+ className: CharactersPanel_module_css_default.help,
6086
+ children: t("dice_compareHelp")
6087
+ })
6088
+ ]
6089
+ }),
6090
+ text(index, "modifier", "dice_modifier", "dice_modifierHelp")
6091
+ ]
6092
+ }),
6093
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6094
+ className: CharactersPanel_module_css_default.label,
6095
+ children: t("dice_bands")
6096
+ }),
6097
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6098
+ className: CharactersPanel_module_css_default.help,
6099
+ children: t("dice_bandsHelp")
6100
+ }),
6101
+ check.bands.map((band, at) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6102
+ className: CharactersPanel_module_css_default.grid,
6103
+ "data-testid": "roleplay-dice-band",
6104
+ children: [
6105
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6106
+ className: CharactersPanel_module_css_default.field,
6107
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6108
+ className: CharactersPanel_module_css_default.label,
6109
+ children: t("dice_bandMin")
6110
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
6111
+ className: CharactersPanel_module_css_default.nameInput,
6112
+ value: band.min,
6113
+ onChange: (event) => {
6114
+ patchBand(index, at, { min: event.target.value });
6115
+ }
6116
+ })]
6117
+ }),
6118
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6119
+ className: CharactersPanel_module_css_default.field,
6120
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6121
+ className: CharactersPanel_module_css_default.label,
6122
+ children: t("dice_bandMax")
6123
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
6124
+ className: CharactersPanel_module_css_default.nameInput,
6125
+ value: band.max,
6126
+ onChange: (event) => {
6127
+ patchBand(index, at, { max: event.target.value });
6128
+ }
6129
+ })]
6130
+ }),
6131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6132
+ className: CharactersPanel_module_css_default.field,
6133
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6134
+ className: CharactersPanel_module_css_default.label,
6135
+ children: t("dice_bandLabel")
6136
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
6137
+ className: CharactersPanel_module_css_default.nameInput,
6138
+ value: band.label,
6139
+ onChange: (event) => {
6140
+ patchBand(index, at, { label: event.target.value });
6141
+ }
6142
+ })]
6143
+ }),
6144
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6145
+ className: CharactersPanel_module_css_default.field,
6146
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6147
+ className: CharactersPanel_module_css_default.label,
6148
+ children: t("dice_bandResult")
6149
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6150
+ value: band.result,
6151
+ onChange: (event) => {
6152
+ patchBand(index, at, { result: event.target.value });
6153
+ },
6154
+ children: [
6155
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6156
+ value: "succeeded",
6157
+ children: t("dice_resultSucceeded")
6158
+ }),
6159
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6160
+ value: "partial",
6161
+ children: t("dice_resultPartial")
6162
+ }),
6163
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6164
+ value: "failed",
6165
+ children: t("dice_resultFailed")
6166
+ })
6167
+ ]
6168
+ })]
6169
+ }),
6170
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6171
+ className: CharactersPanel_module_css_default.field,
6172
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6173
+ className: CharactersPanel_module_css_default.label,
6174
+ children: t("dice_bandCritical")
6175
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
6176
+ type: "checkbox",
6177
+ checked: band.critical,
6178
+ onChange: (event) => {
6179
+ patchBand(index, at, { critical: event.target.checked });
6180
+ }
6181
+ })]
6182
+ }),
6183
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6184
+ variant: "ghost",
6185
+ size: "sm",
6186
+ onClick: () => {
6187
+ patch(index, { bands: check.bands.filter((_, other) => other !== at) });
6188
+ },
6189
+ children: t("dice_bandRemove")
6190
+ })
6191
+ ]
6192
+ }, at)),
6193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6194
+ className: CharactersPanel_module_css_default.grid,
6195
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6196
+ variant: "ghost",
6197
+ size: "sm",
6198
+ onClick: () => {
6199
+ patch(index, { bands: [...check.bands, blankBand()] });
6200
+ },
6201
+ children: t("dice_bandAdd")
6202
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6203
+ variant: "ghost",
6204
+ size: "sm",
6205
+ onClick: () => {
6206
+ change(draft.filter((_, other) => other !== index));
6207
+ },
6208
+ children: t("dice_remove")
6209
+ })]
6210
+ })
6211
+ ]
6212
+ }, index)),
6213
+ draft.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6214
+ className: CharactersPanel_module_css_default.empty,
6215
+ children: t("dice_none")
6216
+ }),
6217
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6218
+ variant: "ghost",
6219
+ size: "sm",
6220
+ onClick: () => {
6221
+ change([...draft, blankCheck()]);
6222
+ },
6223
+ children: t("dice_add")
6224
+ })
6225
+ ]
6226
+ })
6227
+ })
6228
+ ]
6229
+ });
6230
+ }
6231
+ //#endregion
6232
+ //#region src/client/world-editor/variables-draft.ts
6233
+ const list = (value) => value.split(/[,,\n]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
6234
+ const NEW = {
6235
+ key: "",
6236
+ name: "",
6237
+ kind: "number",
6238
+ subject: "character",
6239
+ visibility: "public",
6240
+ description: "",
6241
+ min: "",
6242
+ max: "",
6243
+ integer: false,
6244
+ baseline: false,
6245
+ always: false,
6246
+ default: "",
6247
+ only: "",
6248
+ options: "",
6249
+ bands: ""
6250
+ };
6251
+ const draftOf = (value) => ({
6252
+ key: value.key,
6253
+ name: value.name,
6254
+ kind: value.kind,
6255
+ subject: value.subject,
6256
+ visibility: value.visibility,
6257
+ description: value.description ?? "",
6258
+ min: value.min === void 0 ? "" : String(value.min),
6259
+ max: value.max === void 0 ? "" : String(value.max),
6260
+ integer: value.integer === true,
6261
+ baseline: value.baseline === true,
6262
+ always: value.always === true,
6263
+ default: value.default === void 0 ? "" : String(value.default),
6264
+ only: (value.only ?? []).join(", "),
6265
+ options: (value.options ?? []).join(", "),
6266
+ bands: (value.bands ?? []).map((band) => `${band.up_to}: ${band.label}`).join("\n")
6267
+ });
6268
+ /** The declaration as it will be sent: a default is a number, true/false or text according to the kind; bands are `up to: label` lines. */
6269
+ function declarationOf(draft) {
6270
+ const number = (text) => text.trim() === "" || !Number.isFinite(Number(text)) ? void 0 : Number(text);
6271
+ const defaultValue = draft.default.trim() === "" ? void 0 : draft.kind === "number" ? number(draft.default) ?? draft.default.trim() : draft.kind === "flag" ? draft.default.trim() === "true" : draft.default.trim();
6272
+ const bands = draft.bands.split("\n").flatMap((line) => {
6273
+ const at = line.indexOf(":");
6274
+ const upTo = at < 0 ? void 0 : number(line.slice(0, at));
6275
+ return upTo === void 0 ? [] : [{
6276
+ up_to: upTo,
6277
+ label: line.slice(at + 1).trim()
6278
+ }];
5510
6279
  });
5511
6280
  const [min, max, only, options] = [
5512
6281
  number(draft.min),
@@ -5901,35 +6670,35 @@ window.__ModuleLoader__.load({
5901
6670
  }
5902
6671
  tag$19.textContent = css$19;
5903
6672
  var GalleryView_module_css_default = {
5904
- "editField": "rp_9pSHmG_editField",
5905
- "large": "rp_9pSHmG_large",
5906
- "toolbar": "rp_9pSHmG_toolbar",
5907
- "count": "rp_9pSHmG_count",
5908
- "editButton": "rp_9pSHmG_editButton",
5909
- "message": "rp_9pSHmG_message",
5910
- "facts": "rp_9pSHmG_facts",
5911
- "image": "rp_9pSHmG_image",
6673
+ "edit": "rp_9pSHmG_edit",
5912
6674
  "select": "rp_9pSHmG_select",
5913
- "reusable": "rp_9pSHmG_reusable",
6675
+ "status": "rp_9pSHmG_status",
6676
+ "thumb": "rp_9pSHmG_thumb",
6677
+ "editInput": "rp_9pSHmG_editInput",
6678
+ "message": "rp_9pSHmG_message",
5914
6679
  "editLabel": "rp_9pSHmG_editLabel",
5915
- "error": "rp_9pSHmG_error",
5916
- "pre": "rp_9pSHmG_pre",
6680
+ "reusable": "rp_9pSHmG_reusable",
6681
+ "editArea": "rp_9pSHmG_editArea",
5917
6682
  "editHelp": "rp_9pSHmG_editHelp",
6683
+ "actions": "rp_9pSHmG_actions",
6684
+ "error": "rp_9pSHmG_error",
6685
+ "note": "rp_9pSHmG_note",
6686
+ "facts": "rp_9pSHmG_facts",
5918
6687
  "caption": "rp_9pSHmG_caption",
6688
+ "cell": "rp_9pSHmG_cell",
6689
+ "editField": "rp_9pSHmG_editField",
5919
6690
  "detail": "rp_9pSHmG_detail",
5920
- "editInput": "rp_9pSHmG_editInput",
5921
- "tags": "rp_9pSHmG_tags",
5922
- "editArea": "rp_9pSHmG_editArea",
5923
6691
  "page": "rp_9pSHmG_page",
6692
+ "count": "rp_9pSHmG_count",
5924
6693
  "grid": "rp_9pSHmG_grid",
5925
- "thumb": "rp_9pSHmG_thumb",
5926
- "cell": "rp_9pSHmG_cell",
5927
- "note": "rp_9pSHmG_note",
5928
- "actions": "rp_9pSHmG_actions",
5929
- "open": "rp_9pSHmG_open",
5930
- "edit": "rp_9pSHmG_edit",
6694
+ "image": "rp_9pSHmG_image",
6695
+ "large": "rp_9pSHmG_large",
6696
+ "pre": "rp_9pSHmG_pre",
6697
+ "toolbar": "rp_9pSHmG_toolbar",
6698
+ "tags": "rp_9pSHmG_tags",
6699
+ "editButton": "rp_9pSHmG_editButton",
5931
6700
  "statusError": "rp_9pSHmG_statusError",
5932
- "status": "rp_9pSHmG_status"
6701
+ "open": "rp_9pSHmG_open"
5933
6702
  };
5934
6703
  //#endregion
5935
6704
  //#region src/client/widgets/gallery-view/GalleryView.tsx
@@ -6270,13 +7039,13 @@ window.__ModuleLoader__.load({
6270
7039
  }
6271
7040
  tag$18.textContent = css$18;
6272
7041
  var WorldEditor_module_css_default = {
6273
- "drawerItem": "rp__swA3a_drawerItem",
6274
- "view": "rp__swA3a_view",
6275
- "drawerItemOn": "rp__swA3a_drawerItemOn",
7042
+ "drawer": "rp__swA3a_drawer",
6276
7043
  "content": "rp__swA3a_content",
7044
+ "view": "rp__swA3a_view",
6277
7045
  "warning": "rp__swA3a_warning",
6278
- "message": "rp__swA3a_message",
6279
- "drawer": "rp__swA3a_drawer"
7046
+ "drawerItem": "rp__swA3a_drawerItem",
7047
+ "drawerItemOn": "rp__swA3a_drawerItemOn",
7048
+ "message": "rp__swA3a_message"
6280
7049
  };
6281
7050
  //#endregion
6282
7051
  //#region src/client/world-editor/WorldEditor.tsx
@@ -6345,6 +7114,18 @@ window.__ModuleLoader__.load({
6345
7114
  built: true,
6346
7115
  ownFiles: true
6347
7116
  },
7117
+ {
7118
+ id: "dice",
7119
+ label: "sectionDice",
7120
+ built: true,
7121
+ ownFiles: true
7122
+ },
7123
+ {
7124
+ id: "tools",
7125
+ label: "sectionTools",
7126
+ built: true,
7127
+ ownFiles: true
7128
+ },
6348
7129
  {
6349
7130
  id: "prompts",
6350
7131
  label: "sectionPrompts",
@@ -6487,6 +7268,28 @@ window.__ModuleLoader__.load({
6487
7268
  children: t("editorRefresh")
6488
7269
  })
6489
7270
  }),
7271
+ section === "dice" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DicePanel, {
7272
+ t,
7273
+ worldId: source.worldId,
7274
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
7275
+ variant: "ghost",
7276
+ size: "sm",
7277
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
7278
+ onClick: refresh,
7279
+ children: t("editorRefresh")
7280
+ })
7281
+ }),
7282
+ section === "tools" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolsPanel, {
7283
+ t,
7284
+ worldId: source.worldId,
7285
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
7286
+ variant: "ghost",
7287
+ size: "sm",
7288
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
7289
+ onClick: refresh,
7290
+ children: t("editorRefresh")
7291
+ })
7292
+ }),
6490
7293
  section === "variables" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VariablesPanel, {
6491
7294
  t,
6492
7295
  worldId: source.worldId,
@@ -6636,27 +7439,27 @@ window.__ModuleLoader__.load({
6636
7439
  }
6637
7440
  tag$17.textContent = css$17;
6638
7441
  var AvatarsPage_module_css_default = {
6639
- "text": "rp_pQOzEG_text",
6640
- "name": "rp_pQOzEG_name",
6641
- "editHeader": "rp_pQOzEG_editHeader",
6642
- "grid": "rp_pQOzEG_grid",
6643
- "editBody": "rp_pQOzEG_editBody",
7442
+ "field": "rp_pQOzEG_field",
6644
7443
  "viewport": "rp_pQOzEG_viewport",
6645
- "portrait": "rp_pQOzEG_portrait",
6646
7444
  "page": "rp_pQOzEG_page",
6647
7445
  "count": "rp_pQOzEG_count",
7446
+ "actions": "rp_pQOzEG_actions",
7447
+ "name": "rp_pQOzEG_name",
6648
7448
  "message": "rp_pQOzEG_message",
6649
- "open": "rp_pQOzEG_open",
6650
7449
  "editTitle": "rp_pQOzEG_editTitle",
6651
- "card": "rp_pQOzEG_card",
7450
+ "open": "rp_pQOzEG_open",
6652
7451
  "form": "rp_pQOzEG_form",
6653
- "actions": "rp_pQOzEG_actions",
6654
- "field": "rp_pQOzEG_field",
6655
7452
  "label": "rp_pQOzEG_label",
6656
- "toolbar": "rp_pQOzEG_toolbar",
6657
- "placeholder": "rp_pQOzEG_placeholder",
7453
+ "card": "rp_pQOzEG_card",
7454
+ "portrait": "rp_pQOzEG_portrait",
6658
7455
  "summary": "rp_pQOzEG_summary",
6659
- "error": "rp_pQOzEG_error"
7456
+ "text": "rp_pQOzEG_text",
7457
+ "grid": "rp_pQOzEG_grid",
7458
+ "placeholder": "rp_pQOzEG_placeholder",
7459
+ "editHeader": "rp_pQOzEG_editHeader",
7460
+ "error": "rp_pQOzEG_error",
7461
+ "editBody": "rp_pQOzEG_editBody",
7462
+ "toolbar": "rp_pQOzEG_toolbar"
6660
7463
  };
6661
7464
  //#endregion
6662
7465
  //#region src/client/pages/avatars/AvatarsPage.tsx
@@ -6938,8 +7741,84 @@ window.__ModuleLoader__.load({
6938
7741
  return Object.fromEntries(Object.keys(dictionaries).map((locale) => [locale, Object.fromEntries(Object.entries(dictionaries[locale]).map(([key, value]) => [`${prefix}${key}`, value]))]));
6939
7742
  }
6940
7743
  //#endregion
7744
+ //#region src/client/widgets/tool-switches/locales.ts
7745
+ const dictionaries$14 = {
7746
+ en: {
7747
+ sw_title: "Tools",
7748
+ sw_help: "Which optional tools each kind of agent may use. A choice applies to every agent of that kind, not to one character. Tools this version does not know are left as they are and not shown.",
7749
+ sw_external: "Tools from other plugins: {on} of {count} on",
7750
+ sw_external_help: "Registered by other plugins for everyone (files, a shell, MCP servers such as a search). They are off unless you switch them on, and a tool acts with whatever access its plugin has, so switch on only what this agent should be able to do. A tool that is not registered now is kept here and has no effect.",
7751
+ sw_external_none: "No tools from other plugins are registered right now. Load a plugin that registers tools for everyone (a file or shell tool, an MCP server) and they are offered here.",
7752
+ sw_none: "No optional tools for this agent yet.",
7753
+ sw_default: "default",
7754
+ sw_failed: "Could not change the tools: {message}",
7755
+ sw_agent_gameMaster: "Game master",
7756
+ sw_agent_gameMaster_hint: "Decides what happens and writes the narration.",
7757
+ sw_agent_characters: "Characters",
7758
+ sw_agent_characters_hint: "Every character that is asked to act.",
7759
+ sw_agent_records: "Record keeper",
7760
+ sw_agent_records_hint: "Writes what happened into the story's records in the background.",
7761
+ sw_tool_roll_check: "Roll a check",
7762
+ sw_tool_roll_check_hint: "Rolls one of the world's checks for an uncertain attempt and reads the result with the world's own rules.",
7763
+ sw_tool_roll_dice: "Roll dice",
7764
+ sw_tool_roll_dice_hint: "Rolls plain dice (2d6+1, d100) for what has no check, so that no number is made up.",
7765
+ sw_tool_list_checks: "List checks",
7766
+ sw_tool_list_checks_hint: "Shows the world's checks and when each is used.",
7767
+ sw_tool_recall_my_memories: "Recall memories",
7768
+ sw_tool_recall_my_memories_hint: "Lets a character look up what it remembers when the scene names something its brief left out.",
7769
+ sw_tool_recall_my_known_entities: "Recall known places and things",
7770
+ sw_tool_recall_my_known_entities_hint: "Lets a character look up the places, things and people it knows of.",
7771
+ sw_tool_recall_my_lore: "Recall lore",
7772
+ sw_tool_recall_my_lore_hint: "Lets a character read the canon it explicitly knows.",
7773
+ sw_tool_search_events: "Search events",
7774
+ sw_tool_search_events_hint: "Lets the record keeper search what already happened before it writes.",
7775
+ sw_tool_list_threads: "List open threads",
7776
+ sw_tool_list_threads_hint: "Lets the record keeper see the story threads that are still open.",
7777
+ sw_tool_list_relationships: "List relationships",
7778
+ sw_tool_list_relationships_hint: "Lets the record keeper see how characters stand with each other.",
7779
+ sw_tool_list_items: "List things",
7780
+ sw_tool_list_items_hint: "Lets the record keeper see the things in the story and where they are."
7781
+ },
7782
+ zh: {
7783
+ sw_title: "工具",
7784
+ sw_help: "每一类智能体可以使用哪些可选工具。选择对该类的所有智能体生效,而不是只针对某一个角色。此版本不认识的工具保持原样,也不显示。",
7785
+ sw_external: "来自其他插件的工具:{count} 个中开启 {on} 个",
7786
+ sw_external_help: "由其他插件为所有人注册的工具(文件、命令行、搜索之类的 MCP 服务器)。除非你开启,否则它们都是关闭的;工具以其插件所拥有的权限运行,所以只开启这个智能体应该能做的事。当前没有注册的工具会保留在这里,但不起作用。",
7787
+ sw_external_none: "当前没有其他插件注册的工具。加载一个为所有人注册工具的插件(文件或命令行工具、MCP 服务器)后,它们会在这里提供。",
7788
+ sw_none: "该智能体暂时没有可选工具。",
7789
+ sw_default: "默认",
7790
+ sw_failed: "无法更改工具:{message}",
7791
+ sw_agent_gameMaster: "主持人",
7792
+ sw_agent_gameMaster_hint: "决定发生什么,并撰写叙述。",
7793
+ sw_agent_characters: "角色",
7794
+ sw_agent_characters_hint: "每一个被要求行动的角色。",
7795
+ sw_agent_records: "记录员",
7796
+ sw_agent_records_hint: "在后台把发生的事写入故事记录。",
7797
+ sw_tool_roll_check: "进行检定",
7798
+ sw_tool_roll_check_hint: "为不确定的尝试掷出世界定义的检定,并按世界自己的规则解读结果。",
7799
+ sw_tool_roll_dice: "掷骰子",
7800
+ sw_tool_roll_dice_hint: "为没有检定的事掷普通骰子(2d6+1、d100),不让任何数字被编造。",
7801
+ sw_tool_list_checks: "列出检定",
7802
+ sw_tool_list_checks_hint: "显示世界的检定以及各自的使用场合。",
7803
+ sw_tool_recall_my_memories: "回忆往事",
7804
+ sw_tool_recall_my_memories_hint: "当场景提到简报中没有的内容时,角色可以查阅自己记得的事。",
7805
+ sw_tool_recall_my_known_entities: "回忆所知的地点与事物",
7806
+ sw_tool_recall_my_known_entities_hint: "角色可以查阅自己知道的地点、物品和人物。",
7807
+ sw_tool_recall_my_lore: "回忆典故",
7808
+ sw_tool_recall_my_lore_hint: "角色可以阅读自己明确知道的设定。",
7809
+ sw_tool_search_events: "搜索事件",
7810
+ sw_tool_search_events_hint: "记录员在写入前可以搜索已经发生的事。",
7811
+ sw_tool_list_threads: "列出未了线索",
7812
+ sw_tool_list_threads_hint: "记录员可以查看仍未了结的故事线索。",
7813
+ sw_tool_list_relationships: "列出关系",
7814
+ sw_tool_list_relationships_hint: "记录员可以查看角色之间的关系。",
7815
+ sw_tool_list_items: "列出物品",
7816
+ sw_tool_list_items_hint: "记录员可以查看故事中的物品及其位置。"
7817
+ }
7818
+ };
7819
+ //#endregion
6941
7820
  //#region src/client/widgets/gallery-view/locales.ts
6942
- const dictionaries$12 = {
7821
+ const dictionaries$13 = {
6943
7822
  en: {
6944
7823
  tab: "Gallery",
6945
7824
  notRoleplay: "This chat is not a roleplay session, so it has no gallery.",
@@ -7017,7 +7896,7 @@ window.__ModuleLoader__.load({
7017
7896
  cancel: "取消"
7018
7897
  }
7019
7898
  };
7020
- const dictionaries$9 = withDictionaries(withDictionaries(withDictionaries({
7899
+ const dictionaries$9 = withDictionaries(withDictionaries(withDictionaries(withDictionaries(withDictionaries({
7021
7900
  en: {
7022
7901
  language: "en",
7023
7902
  sectionInfo: "About",
@@ -7030,6 +7909,8 @@ window.__ModuleLoader__.load({
7030
7909
  infoOpening: "Opening message",
7031
7910
  infoOpeningHelp: "What the story begins with, before the player says anything. Leave empty for none.",
7032
7911
  infoOpeningParts: "This opening has lines spoken by characters, so it cannot be edited here as plain text. Change it in the file, or ask the authoring assistant.",
7912
+ sectionDice: "Dice",
7913
+ sectionTools: "Tools",
7033
7914
  sectionCalendar: "Calendar",
7034
7915
  calendarHelp: "The seasons follow the hemisphere, and a holiday is told by the days it falls on: a date (09-21), a span (12-20..01-05), a weekday of the month (nth:fri:last), a month or a season. Routines, triggers and the time shown to the models can name a holiday with holiday:<id>.",
7035
7916
  calendarHemisphere: "Seasons follow",
@@ -7094,6 +7975,8 @@ window.__ModuleLoader__.load({
7094
7975
  variableVisibility_public: "Anyone present",
7095
7976
  variableVisibility_private: "Only itself",
7096
7977
  variableVisibility_hidden: "Nobody (game master only)",
7978
+ infoAlternateFor: "For",
7979
+ infoAlternateAny: "Any character",
7097
7980
  infoAlternates: "Other openings",
7098
7981
  infoAlternatesHelp: "Other ways the story can begin. The player picks one when starting a session; each is one narration, shown instead of the opening message.",
7099
7982
  infoAlternateTitle: "Title",
@@ -7301,6 +8184,8 @@ window.__ModuleLoader__.load({
7301
8184
  infoOpening: "开场白",
7302
8185
  infoOpeningHelp: "玩家开口之前故事的开头。留空表示没有。",
7303
8186
  infoOpeningParts: "这段开场白含有角色说的话,因此不能在这里按纯文本编辑。请在文件中修改,或请创作助手处理。",
8187
+ sectionDice: "骰子",
8188
+ sectionTools: "工具",
7304
8189
  sectionCalendar: "日历",
7305
8190
  calendarHelp: "季节随半球而定;节日用它所在的日子来表示:某个日期(09-21)、一段日期(12-20..01-05)、某月的第几个星期几(nth:fri:last)、整个月或某个季节。日常、触发器和提供给模型的时间都可以用 holiday:<id> 引用节日。",
7306
8191
  calendarHemisphere: "季节依据",
@@ -7365,6 +8250,8 @@ window.__ModuleLoader__.load({
7365
8250
  variableVisibility_public: "在场者皆可",
7366
8251
  variableVisibility_private: "仅自己",
7367
8252
  variableVisibility_hidden: "无人(仅主持人)",
8253
+ infoAlternateFor: "适用于",
8254
+ infoAlternateAny: "任何角色",
7368
8255
  infoAlternates: "其他开场",
7369
8256
  infoAlternatesHelp: "故事的其他开始方式。玩家开始会话时选择其一;每个都是一段叙述,会代替开场白显示。",
7370
8257
  infoAlternateTitle: "标题",
@@ -7560,7 +8447,7 @@ window.__ModuleLoader__.load({
7560
8447
  relationCancel: "取消",
7561
8448
  relationCreate: "创建"
7562
8449
  }
7563
- }, prefixed(dictionaries$12, "gallery_")), prefixed({
8450
+ }, prefixed(dictionaries$13, "gallery_")), prefixed({
7564
8451
  en: {
7565
8452
  title: "Triggers",
7566
8453
  help: "What the world does by itself when something comes true. They are read from triggers.json; ask the authoring assistant to make or change them, or edit the file.",
@@ -7736,7 +8623,80 @@ window.__ModuleLoader__.load({
7736
8623
  logOpen: "请求打开:{surface}",
7737
8624
  noSurfaces: "这个界面包没有可预览的界面位置。"
7738
8625
  }
7739
- }, "pk_"));
8626
+ }, "pk_")), dictionaries$14), prefixed({
8627
+ en: {
8628
+ help: "How uncertain attempts are settled. The game master rolls one of these checks and is told which band the roll fell in, so no number is ever made up. Each check says when it is used, the dice it rolls and what each result means; the bands together should cover every value the dice can give.",
8629
+ none: "This world has no checks. Its game master can still roll plain dice for things that have none.",
8630
+ add: "Add a check",
8631
+ remove: "Remove this check",
8632
+ checkTitle: "Check",
8633
+ key: "Key",
8634
+ name: "Name",
8635
+ use: "When it is used",
8636
+ useHelp: "Said to the game master in your words: what kind of attempt it is for, and how hard is hard (for example \"target 10 moderate, 15 hard\").",
8637
+ dice: "Dice",
8638
+ diceHelp: "2d6+1, 1d20, 4d6kh3 (keep the highest 3), d100.",
8639
+ reading: "Read as",
8640
+ readTotal: "The total of the dice",
8641
+ readSuccesses: "The number of dice that hit",
8642
+ hit: "A die hits from",
8643
+ compare: "Compared with",
8644
+ compareAbsolute: "Nothing: the value itself",
8645
+ compareOver: "A difficulty to meet or beat",
8646
+ compareUnder: "A skill to roll under",
8647
+ compareHelp: "With a difficulty or a skill, the game master gives the number, and the bands read how far over or under it the roll is.",
8648
+ modifier: "Adds a quality of the character",
8649
+ modifierHelp: "The key of a number about characters declared in Tracked values, or empty.",
8650
+ bands: "Results",
8651
+ bandsHelp: "The first band that holds the value is the result. Leave \"from\" or \"to\" empty for no end.",
8652
+ bandAdd: "Add a result",
8653
+ bandRemove: "Remove",
8654
+ bandMin: "From",
8655
+ bandMax: "To",
8656
+ bandLabel: "Called",
8657
+ bandResult: "Counts as",
8658
+ resultSucceeded: "Success",
8659
+ resultPartial: "Partial",
8660
+ resultFailed: "Failure",
8661
+ bandCritical: "Critical"
8662
+ },
8663
+ zh: {
8664
+ help: "不确定的尝试如何裁定。主持人掷出其中一个检定,并被告知掷出的结果落在哪个区段,因此不会有任何数字被编造。每个检定写明何时使用、掷什么骰子,以及每种结果意味着什么;各区段合起来应覆盖骰子可能给出的每个数值。",
8665
+ none: "这个世界没有检定。它的主持人仍然可以为没有检定的事掷普通骰子。",
8666
+ add: "添加检定",
8667
+ remove: "删除此检定",
8668
+ checkTitle: "检定",
8669
+ key: "标识",
8670
+ name: "名称",
8671
+ use: "何时使用",
8672
+ useHelp: "用你的话告诉主持人:它适用于哪一类尝试,以及怎样算难(例如“目标 10 为中等,15 为困难”)。",
8673
+ dice: "骰子",
8674
+ diceHelp: "2d6+1、1d20、4d6kh3(保留最高的 3 个)、d100。",
8675
+ reading: "读取方式",
8676
+ readTotal: "骰子的总和",
8677
+ readSuccesses: "命中的骰子数",
8678
+ hit: "骰子从多少起算命中",
8679
+ compare: "与什么比较",
8680
+ compareAbsolute: "不比较:直接读取数值",
8681
+ compareOver: "要达到或超过的难度",
8682
+ compareUnder: "要掷低于的技能值",
8683
+ compareHelp: "选择难度或技能值时,由主持人给出该数字,区段读取的是掷出的结果比它高出或低多少。",
8684
+ modifier: "加上角色的某项属性",
8685
+ modifierHelp: "在“追踪数值”中声明的、关于角色的数值的 key;留空为不加。",
8686
+ bands: "结果",
8687
+ bandsHelp: "第一个包含该数值的区段就是结果。“从”或“到”留空表示没有上限或下限。",
8688
+ bandAdd: "添加结果",
8689
+ bandRemove: "删除",
8690
+ bandMin: "从",
8691
+ bandMax: "到",
8692
+ bandLabel: "称为",
8693
+ bandResult: "算作",
8694
+ resultSucceeded: "成功",
8695
+ resultPartial: "部分成功",
8696
+ resultFailed: "失败",
8697
+ bandCritical: "关键"
8698
+ }
8699
+ }, "dice_"));
7740
8700
  const dictionaries$8 = withDictionaries({
7741
8701
  en: {
7742
8702
  nav: "Avatars",
@@ -7852,8 +8812,8 @@ window.__ModuleLoader__.load({
7852
8812
  }
7853
8813
  tag$16.textContent = css$16;
7854
8814
  var Pager_module_css_default = {
7855
- "pager": "rp_KBAD0W_pager",
7856
- "position": "rp_KBAD0W_position"
8815
+ "position": "rp_KBAD0W_position",
8816
+ "pager": "rp_KBAD0W_pager"
7857
8817
  };
7858
8818
  //#endregion
7859
8819
  //#region src/client/widgets/pager/Pager.tsx
@@ -7926,9 +8886,9 @@ window.__ModuleLoader__.load({
7926
8886
  }
7927
8887
  tag$14.textContent = css$14;
7928
8888
  var DeleteSessionDialog_module_css_default = {
7929
- "question": "rp_FifHrW_question",
7930
8889
  "warning": "rp_FifHrW_warning",
7931
8890
  "body": "rp_FifHrW_body",
8891
+ "question": "rp_FifHrW_question",
7932
8892
  "error": "rp_FifHrW_error"
7933
8893
  };
7934
8894
  //#endregion
@@ -8031,33 +8991,33 @@ window.__ModuleLoader__.load({
8031
8991
  if (tag$13 === null) {
8032
8992
  tag$13 = document.createElement("style");
8033
8993
  tag$13.dataset.plugin = "@dsh-agentic-roleplay/core";
8034
- tag$13.dataset.pluginCss = key$13;
8035
- document.head.appendChild(tag$13);
8036
- }
8037
- tag$13.textContent = css$13;
8038
- var SessionsPage_module_css_default = {
8039
- "actionsColumn": "rp_24z4eW_actionsColumn",
8040
- "name": "rp_24z4eW_name",
8041
- "page": "rp_24z4eW_page",
8042
- "turnsColumn": "rp_24z4eW_turnsColumn",
8043
- "badge": "rp_24z4eW_badge",
8044
- "toolbar": "rp_24z4eW_toolbar",
8045
- "spinning": "rp_24z4eW_spinning",
8046
- "table": "rp_24z4eW_table",
8047
- "nameColumn": "rp_24z4eW_nameColumn",
8048
- "timeColumn": "rp_24z4eW_timeColumn",
8994
+ tag$13.dataset.pluginCss = key$13;
8995
+ document.head.appendChild(tag$13);
8996
+ }
8997
+ tag$13.textContent = css$13;
8998
+ var SessionsPage_module_css_default = {
8049
8999
  "archived": "rp_24z4eW_archived",
9000
+ "fits": "rp_24z4eW_fits",
9001
+ "actions": "rp_24z4eW_actions",
9002
+ "nameColumn": "rp_24z4eW_nameColumn",
8050
9003
  "scrolls": "rp_24z4eW_scrolls",
9004
+ "toolbar": "rp_24z4eW_toolbar",
8051
9005
  "secondary": "rp_24z4eW_secondary",
9006
+ "table": "rp_24z4eW_table",
9007
+ "viewport": "rp_24z4eW_viewport",
9008
+ "name": "rp_24z4eW_name",
9009
+ "timeColumn": "rp_24z4eW_timeColumn",
8052
9010
  "message": "rp_24z4eW_message",
9011
+ "notice": "rp_24z4eW_notice",
9012
+ "actionsColumn": "rp_24z4eW_actionsColumn",
8053
9013
  "spin": "rp_24z4eW_spin",
8054
- "fits": "rp_24z4eW_fits",
9014
+ "spinning": "rp_24z4eW_spinning",
9015
+ "page": "rp_24z4eW_page",
9016
+ "worldColumn": "rp_24z4eW_worldColumn",
8055
9017
  "number": "rp_24z4eW_number",
8056
- "actions": "rp_24z4eW_actions",
9018
+ "badge": "rp_24z4eW_badge",
8057
9019
  "count": "rp_24z4eW_count",
8058
- "notice": "rp_24z4eW_notice",
8059
- "viewport": "rp_24z4eW_viewport",
8060
- "worldColumn": "rp_24z4eW_worldColumn"
9020
+ "turnsColumn": "rp_24z4eW_turnsColumn"
8061
9021
  };
8062
9022
  //#endregion
8063
9023
  //#region src/client/pages/sessions/SessionsPage.tsx
@@ -8573,16 +9533,16 @@ window.__ModuleLoader__.load({
8573
9533
  }
8574
9534
  tag$12.textContent = css$12;
8575
9535
  var WorldCard_module_css_default = {
8576
- "cover": "rp_Bvxx5q_cover",
8577
- "tag": "rp_Bvxx5q_tag",
8578
- "play": "rp_Bvxx5q_play",
8579
- "info": "rp_Bvxx5q_info",
9536
+ "openButton": "rp_Bvxx5q_openButton",
9537
+ "tags": "rp_Bvxx5q_tags",
8580
9538
  "card": "rp_Bvxx5q_card",
8581
- "image": "rp_Bvxx5q_image",
8582
9539
  "name": "rp_Bvxx5q_name",
8583
- "tags": "rp_Bvxx5q_tags",
8584
- "openButton": "rp_Bvxx5q_openButton",
8585
- "placeholder": "rp_Bvxx5q_placeholder"
9540
+ "placeholder": "rp_Bvxx5q_placeholder",
9541
+ "play": "rp_Bvxx5q_play",
9542
+ "cover": "rp_Bvxx5q_cover",
9543
+ "image": "rp_Bvxx5q_image",
9544
+ "tag": "rp_Bvxx5q_tag",
9545
+ "info": "rp_Bvxx5q_info"
8586
9546
  };
8587
9547
  //#endregion
8588
9548
  //#region src/client/widgets/world-card/WorldCard.tsx
@@ -8676,10 +9636,10 @@ window.__ModuleLoader__.load({
8676
9636
  }
8677
9637
  tag$11.textContent = css$11;
8678
9638
  var AvatarChoices_module_css_default = {
9639
+ "name": "rp_YCstOG_name",
8679
9640
  "option": "rp_YCstOG_option",
8680
- "text": "rp_YCstOG_text",
8681
9641
  "summary": "rp_YCstOG_summary",
8682
- "name": "rp_YCstOG_name"
9642
+ "text": "rp_YCstOG_text"
8683
9643
  };
8684
9644
  //#endregion
8685
9645
  //#region src/client/widgets/avatar-choices/AvatarChoices.tsx
@@ -8719,18 +9679,18 @@ window.__ModuleLoader__.load({
8719
9679
  }
8720
9680
  tag$10.textContent = css$10;
8721
9681
  var StartSessionDialog_module_css_default = {
9682
+ "advancedBody": "rp_AnbLKG_advancedBody",
9683
+ "option": "rp_AnbLKG_option",
8722
9684
  "optionText": "rp_AnbLKG_optionText",
8723
- "label": "rp_AnbLKG_label",
9685
+ "optionSummary": "rp_AnbLKG_optionSummary",
9686
+ "field": "rp_AnbLKG_field",
9687
+ "optionName": "rp_AnbLKG_optionName",
8724
9688
  "message": "rp_AnbLKG_message",
8725
- "advanced": "rp_AnbLKG_advanced",
9689
+ "error": "rp_AnbLKG_error",
8726
9690
  "advancedToggle": "rp_AnbLKG_advancedToggle",
9691
+ "label": "rp_AnbLKG_label",
8727
9692
  "form": "rp_AnbLKG_form",
8728
- "advancedBody": "rp_AnbLKG_advancedBody",
8729
- "field": "rp_AnbLKG_field",
8730
- "error": "rp_AnbLKG_error",
8731
- "optionName": "rp_AnbLKG_optionName",
8732
- "option": "rp_AnbLKG_option",
8733
- "optionSummary": "rp_AnbLKG_optionSummary"
9693
+ "advanced": "rp_AnbLKG_advanced"
8734
9694
  };
8735
9695
  //#endregion
8736
9696
  //#region src/client/pages/worlds/AddAvatarsDialog.tsx
@@ -8845,6 +9805,7 @@ window.__ModuleLoader__.load({
8845
9805
  kind: "record",
8846
9806
  fallback: {}
8847
9807
  });
9808
+ const switchboard = () => ({ kind: "switchboard" });
8848
9809
  const choice = (options, fallback) => ({
8849
9810
  kind: "choice",
8850
9811
  options,
@@ -8958,11 +9919,13 @@ window.__ModuleLoader__.load({
8958
9919
  interpreterModel: text(200, ""),
8959
9920
  captioner: text(200, "")
8960
9921
  },
9922
+ dice: { visibility: choice(["hidden", "card"], "card") },
9923
+ tools: switchboard(),
8961
9924
  embedding: { options: record() }
8962
9925
  };
8963
9926
  const isField = (spec) => "kind" in spec && typeof spec["kind"] === "string";
8964
9927
  function defaultsOf(spec) {
8965
- return Object.fromEntries(Object.entries(spec).map(([key, entry]) => [key, isField(entry) ? entry.kind === "record" ? { ...entry.fallback } : entry.fallback : defaultsOf(entry)]));
9928
+ return Object.fromEntries(Object.entries(spec).map(([key, entry]) => [key, isField(entry) ? entry.kind === "record" ? { ...entry.fallback } : entry.kind === "switchboard" ? {} : entry.fallback : defaultsOf(entry)]));
8966
9929
  }
8967
9930
  const DEFAULT_SETTINGS = defaultsOf(SETTINGS_SPEC);
8968
9931
  /** Whether a name is a time zone the runtime knows. */
@@ -9271,6 +10234,19 @@ window.__ModuleLoader__.load({
9271
10234
  label: "suggestionsCount",
9272
10235
  help: "suggestionsCountHelp"
9273
10236
  },
10237
+ {
10238
+ path: ["dice", "visibility"],
10239
+ kind: "choice",
10240
+ label: "diceVisibility",
10241
+ help: "diceVisibilityHelp",
10242
+ choices: [{
10243
+ value: "hidden",
10244
+ label: "diceHidden"
10245
+ }, {
10246
+ value: "card",
10247
+ label: "diceCard"
10248
+ }]
10249
+ },
9274
10250
  {
9275
10251
  path: ["images", "mode"],
9276
10252
  kind: "choice",
@@ -9587,14 +10563,14 @@ window.__ModuleLoader__.load({
9587
10563
  }
9588
10564
  tag$9.textContent = css$9;
9589
10565
  var SettingsFields_module_css_default = {
10566
+ "row": "rp_Rhi3yq_row",
9590
10567
  "field": "rp_Rhi3yq_field",
9591
- "help": "rp_Rhi3yq_help",
9592
10568
  "groupTitle": "rp_Rhi3yq_groupTitle",
9593
- "error": "rp_Rhi3yq_error",
9594
10569
  "group": "rp_Rhi3yq_group",
9595
- "row": "rp_Rhi3yq_row",
10570
+ "error": "rp_Rhi3yq_error",
9596
10571
  "label": "rp_Rhi3yq_label",
9597
- "area": "rp_Rhi3yq_area"
10572
+ "area": "rp_Rhi3yq_area",
10573
+ "help": "rp_Rhi3yq_help"
9598
10574
  };
9599
10575
  //#endregion
9600
10576
  //#region src/client/settings-form/SettingsFields.tsx
@@ -9793,6 +10769,18 @@ window.__ModuleLoader__.load({
9793
10769
  body: file
9794
10770
  }));
9795
10771
  }
10772
+ /** Sends a narration preset to a world, which has its authoring chat turn it into the world's prose prompts. */
10773
+ async function uploadPreset(worldId, file, language) {
10774
+ return await answer$1(await fetch(`${API_PREFIX}/worlds/import/preset?id=${encodeURIComponent(worldId)}&language=${encodeURIComponent(language)}`, {
10775
+ method: "POST",
10776
+ credentials: "same-origin",
10777
+ headers: {
10778
+ "x-file-name": encodeURIComponent(file.name),
10779
+ "content-type": "application/json"
10780
+ },
10781
+ body: file
10782
+ }));
10783
+ }
9796
10784
  async function startImport(id, choices, language) {
9797
10785
  return await answer$1(await fetch(`${API_PREFIX}/worlds/import/start?id=${encodeURIComponent(id)}`, {
9798
10786
  method: "POST",
@@ -9936,6 +10924,8 @@ window.__ModuleLoader__.load({
9936
10924
  summary: avatar.summary
9937
10925
  }))];
9938
10926
  const selected = players.find((player) => player.value === choice)?.value ?? players[0]?.value;
10927
+ const chosenOpening = opening === "" ? void 0 : dialog.openings[Number(opening)];
10928
+ const openingValid = chosenOpening !== void 0 && (chosenOpening.character === void 0 || chosenOpening.character === selected);
9939
10929
  const base = {
9940
10930
  ...DEFAULT_SETTINGS,
9941
10931
  prompts: { language: t("language") }
@@ -9975,7 +10965,7 @@ window.__ModuleLoader__.load({
9975
10965
  name,
9976
10966
  ...selected.startsWith("avatar:") ? { playerAvatar: selected.slice(7) } : { playerCharacterId: selected },
9977
10967
  avatars: bringing.map((avatar) => avatar.key),
9978
- ...opening === "" ? {} : { opening: Number(opening) },
10968
+ ...!openingValid ? {} : { opening: Number(opening) },
9979
10969
  ...startTime.trim() === "" || shown["clock.mode"] === "real" ? {} : { startingTime: startTime.trim() },
9980
10970
  settings: fromDrafts(base, shown, options)
9981
10971
  });
@@ -10047,13 +11037,13 @@ window.__ModuleLoader__.load({
10047
11037
  }, player.value))
10048
11038
  ]
10049
11039
  }),
10050
- dialog.status === "ready" && dialog.openings.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11040
+ dialog.status === "ready" && dialog.openings.some((entry) => entry.character === void 0 || entry.character === selected) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10051
11041
  className: StartSessionDialog_module_css_default.field,
10052
11042
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10053
11043
  className: StartSessionDialog_module_css_default.label,
10054
11044
  children: t("startOpening")
10055
11045
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
10056
- value: opening,
11046
+ value: openingValid ? opening : "",
10057
11047
  disabled: dialog.submitting,
10058
11048
  onChange: (event) => {
10059
11049
  setOpening(event.target.value);
@@ -10061,10 +11051,10 @@ window.__ModuleLoader__.load({
10061
11051
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10062
11052
  value: "",
10063
11053
  children: t("startOpeningDefault")
10064
- }), dialog.openings.map((title, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11054
+ }), dialog.openings.flatMap((entry, index) => entry.character === void 0 || entry.character === selected ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10065
11055
  value: String(index),
10066
- children: title
10067
- }, index))]
11056
+ children: entry.title
11057
+ }, index)] : [])]
10068
11058
  })]
10069
11059
  }),
10070
11060
  dialog.status === "ready" && shown["clock.mode"] !== "real" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -10324,25 +11314,25 @@ window.__ModuleLoader__.load({
10324
11314
  }
10325
11315
  tag$7.textContent = css$7;
10326
11316
  var WorldsPage_module_css_default = {
10327
- "spinning": "rp_FHUyRq_spinning",
10328
- "authorButton": "rp_FHUyRq_authorButton",
11317
+ "editTitle": "rp_FHUyRq_editTitle",
10329
11318
  "editHeader": "rp_FHUyRq_editHeader",
11319
+ "grid": "rp_FHUyRq_grid",
11320
+ "message": "rp_FHUyRq_message",
11321
+ "toolbar": "rp_FHUyRq_toolbar",
11322
+ "spin": "rp_FHUyRq_spin",
11323
+ "notice": "rp_FHUyRq_notice",
11324
+ "scrolls": "rp_FHUyRq_scrolls",
10330
11325
  "fits": "rp_FHUyRq_fits",
10331
- "count": "rp_FHUyRq_count",
10332
- "editTitle": "rp_FHUyRq_editTitle",
11326
+ "cell": "rp_FHUyRq_cell",
10333
11327
  "editBody": "rp_FHUyRq_editBody",
10334
- "scrolls": "rp_FHUyRq_scrolls",
10335
- "grid": "rp_FHUyRq_grid",
11328
+ "authorButton": "rp_FHUyRq_authorButton",
10336
11329
  "starter": "rp_FHUyRq_starter",
10337
- "page": "rp_FHUyRq_page",
10338
- "cell": "rp_FHUyRq_cell",
10339
- "starters": "rp_FHUyRq_starters",
10340
- "spin": "rp_FHUyRq_spin",
11330
+ "viewport": "rp_FHUyRq_viewport",
10341
11331
  "toolbarActions": "rp_FHUyRq_toolbarActions",
10342
- "notice": "rp_FHUyRq_notice",
10343
- "message": "rp_FHUyRq_message",
10344
- "toolbar": "rp_FHUyRq_toolbar",
10345
- "viewport": "rp_FHUyRq_viewport"
11332
+ "spinning": "rp_FHUyRq_spinning",
11333
+ "starters": "rp_FHUyRq_starters",
11334
+ "count": "rp_FHUyRq_count",
11335
+ "page": "rp_FHUyRq_page"
10346
11336
  };
10347
11337
  //#endregion
10348
11338
  //#region src/client/pages/worlds/StarterWorlds.tsx
@@ -10412,34 +11402,34 @@ window.__ModuleLoader__.load({
10412
11402
  }
10413
11403
  tag$6.textContent = css$6;
10414
11404
  var ImportCardPage_module_css_default = {
11405
+ "noPicture": "rp_DmG_oG_noPicture",
11406
+ "picture": "rp_DmG_oG_picture",
11407
+ "space": "rp_DmG_oG_space",
10415
11408
  "error": "rp_DmG_oG_error",
10416
11409
  "entry": "rp_DmG_oG_entry",
10417
- "entryHead": "rp_DmG_oG_entryHead",
10418
- "entryOff": "rp_DmG_oG_entryOff",
10419
- "page": "rp_DmG_oG_page",
10420
11410
  "body": "rp_DmG_oG_body",
11411
+ "entryHead": "rp_DmG_oG_entryHead",
11412
+ "title": "rp_DmG_oG_title",
10421
11413
  "fieldTitle": "rp_DmG_oG_fieldTitle",
11414
+ "entryTitle": "rp_DmG_oG_entryTitle",
10422
11415
  "top": "rp_DmG_oG_top",
10423
- "fieldHead": "rp_DmG_oG_fieldHead",
10424
11416
  "choice": "rp_DmG_oG_choice",
10425
- "picture": "rp_DmG_oG_picture",
10426
- "choiceText": "rp_DmG_oG_choiceText",
10427
- "preview": "rp_DmG_oG_preview",
10428
- "space": "rp_DmG_oG_space",
10429
- "note": "rp_DmG_oG_note",
10430
- "row": "rp_DmG_oG_row",
10431
11417
  "field": "rp_DmG_oG_field",
10432
- "noPicture": "rp_DmG_oG_noPicture",
10433
- "entryTitle": "rp_DmG_oG_entryTitle",
10434
- "fieldMeta": "rp_DmG_oG_fieldMeta",
10435
- "text": "rp_DmG_oG_text",
10436
- "section": "rp_DmG_oG_section",
10437
- "tags": "rp_DmG_oG_tags",
11418
+ "row": "rp_DmG_oG_row",
10438
11419
  "header": "rp_DmG_oG_header",
11420
+ "note": "rp_DmG_oG_note",
11421
+ "fieldHead": "rp_DmG_oG_fieldHead",
11422
+ "choiceText": "rp_DmG_oG_choiceText",
11423
+ "about": "rp_DmG_oG_about",
10439
11424
  "label": "rp_DmG_oG_label",
11425
+ "tags": "rp_DmG_oG_tags",
11426
+ "section": "rp_DmG_oG_section",
11427
+ "page": "rp_DmG_oG_page",
10440
11428
  "heading": "rp_DmG_oG_heading",
10441
- "title": "rp_DmG_oG_title",
10442
- "about": "rp_DmG_oG_about"
11429
+ "preview": "rp_DmG_oG_preview",
11430
+ "entryOff": "rp_DmG_oG_entryOff",
11431
+ "text": "rp_DmG_oG_text",
11432
+ "fieldMeta": "rp_DmG_oG_fieldMeta"
10443
11433
  };
10444
11434
  //#endregion
10445
11435
  //#region src/client/pages/worlds/ImportCardPage.tsx
@@ -10795,6 +11785,9 @@ window.__ModuleLoader__.load({
10795
11785
  const [uploading, setUploading] = (0, react.useState)(false);
10796
11786
  const [importNotice, setImportNotice] = (0, react.useState)();
10797
11787
  const picker = (0, react.useRef)(null);
11788
+ const presetPicker = (0, react.useRef)(null);
11789
+ const [presetBusy, setPresetBusy] = (0, react.useState)(false);
11790
+ const [presetNotice, setPresetNotice] = (0, react.useState)();
10798
11791
  const source = (0, react.useMemo)(() => editing === void 0 ? void 0 : worldSource(editing.id), [editing]);
10799
11792
  (0, react.useEffect)(() => {
10800
11793
  load();
@@ -10820,6 +11813,19 @@ window.__ModuleLoader__.load({
10820
11813
  setImportNotice(t("importUploadFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
10821
11814
  });
10822
11815
  };
11816
+ const choosePreset = (world, file) => {
11817
+ if (file === void 0) return;
11818
+ setPresetBusy(true);
11819
+ setPresetNotice(void 0);
11820
+ uploadPreset(world, file, t("language")).then((opened) => {
11821
+ setPresetBusy(false);
11822
+ if (!opened.started) setPresetNotice(t("presetNotStarted", { message: opened.failure ?? "" }));
11823
+ openChat(opened.chatSessionId);
11824
+ }, (failure) => {
11825
+ setPresetBusy(false);
11826
+ setPresetNotice(t("presetFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
11827
+ });
11828
+ };
10823
11829
  if (importing !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10824
11830
  className: WorldsPage_module_css_default.page,
10825
11831
  "data-testid": "roleplay-world-import",
@@ -10857,8 +11863,28 @@ window.__ModuleLoader__.load({
10857
11863
  className: WorldsPage_module_css_default.editTitle,
10858
11864
  children: editing.name
10859
11865
  }),
11866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11867
+ ref: presetPicker,
11868
+ type: "file",
11869
+ accept: ".json,application/json",
11870
+ hidden: true,
11871
+ "data-testid": "roleplay-preset-input",
11872
+ onChange: (event) => {
11873
+ choosePreset(editing.id, event.target.files?.[0]);
11874
+ event.target.value = "";
11875
+ }
11876
+ }),
10860
11877
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
10861
11878
  className: WorldsPage_module_css_default.authorButton,
11879
+ variant: "outline",
11880
+ size: "sm",
11881
+ disabled: presetBusy,
11882
+ onClick: () => {
11883
+ presetPicker.current?.click();
11884
+ },
11885
+ children: presetBusy ? t("presetOpening") : t("importPreset")
11886
+ }),
11887
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
10862
11888
  variant: "outline",
10863
11889
  size: "sm",
10864
11890
  onClick: () => {
@@ -10882,6 +11908,11 @@ window.__ModuleLoader__.load({
10882
11908
  role: "alert",
10883
11909
  children: t("authorWorldFailed", { message: state.authoring.error })
10884
11910
  }),
11911
+ presetNotice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11912
+ className: WorldsPage_module_css_default.notice,
11913
+ role: "alert",
11914
+ children: presetNotice
11915
+ }),
10885
11916
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslateBanner, {
10886
11917
  t,
10887
11918
  worldId: editing.id,
@@ -11169,6 +12200,10 @@ window.__ModuleLoader__.load({
11169
12200
  modelsSuggestionsHelp: "As provider/model. Leave empty to use the chat's own model.",
11170
12201
  modelsAuthoring: "Model for the world and plot author",
11171
12202
  modelsAuthoringHelp: "As provider/model. Leave empty to use the chat's own model. Made-up characters, places and things are only as good as this model.",
12203
+ diceVisibility: "Dice",
12204
+ diceVisibilityHelp: "What the player sees of the dice the game master rolls: a collapsed card under the narration to open when you want to check, or nothing, to stay in the story. The dice are rolled either way.",
12205
+ diceHidden: "Hidden",
12206
+ diceCard: "Collapsed card",
11172
12207
  imagesOff: "Off",
11173
12208
  imagesManual: "Manual",
11174
12209
  imagesEveryTurn: "Every turn",
@@ -11318,6 +12353,10 @@ window.__ModuleLoader__.load({
11318
12353
  modelsSuggestionsHelp: "写成 提供方/模型。留空则使用对话自己的模型。",
11319
12354
  modelsAuthoring: "世界与剧情作者使用的模型",
11320
12355
  modelsAuthoringHelp: "写成 提供方/模型。留空则使用对话自己的模型。新编造的角色、地点和物品的质量取决于这个模型。",
12356
+ diceVisibility: "骰子",
12357
+ diceVisibilityHelp: "玩家能看到主持人掷出的骰子的什么:叙述下方一张折叠的卡片,想核对时可以展开;或什么都不显示,保持沉浸在故事里。无论哪种,骰子都会照常掷出。",
12358
+ diceHidden: "隐藏",
12359
+ diceCard: "折叠卡片",
11321
12360
  imagesOff: "关闭",
11322
12361
  imagesManual: "手动",
11323
12362
  imagesEveryTurn: "每轮",
@@ -11444,6 +12483,10 @@ window.__ModuleLoader__.load({
11444
12483
  worldFolderHelp: "A new folder directly inside the roleplay worlds directory.",
11445
12484
  worldName: "World name",
11446
12485
  createWorldFailed: "Could not create the world: {message}",
12486
+ importPreset: "Import narration preset",
12487
+ presetOpening: "Opening…",
12488
+ presetFailed: "Could not import the preset: {message}",
12489
+ presetNotStarted: "The authoring chat opened but the preset was not applied: {message}. Ask it to apply the preset you uploaded.",
11447
12490
  authorWorld: "Author with AI",
11448
12491
  openingAuthor: "Opening…",
11449
12492
  authorWorldFailed: "Could not open the authoring chat: {message}",
@@ -11549,6 +12592,10 @@ window.__ModuleLoader__.load({
11549
12592
  worldFolderHelp: "将在角色扮演 worlds 目录下直接创建这个文件夹。",
11550
12593
  worldName: "世界名称",
11551
12594
  createWorldFailed: "无法创建世界:{message}",
12595
+ importPreset: "导入叙述预设",
12596
+ presetOpening: "正在打开…",
12597
+ presetFailed: "无法导入预设:{message}",
12598
+ presetNotStarted: "世界编辑对话已打开,但预设没有应用:{message}。可以请它应用你上传的预设。",
11552
12599
  authorWorld: "使用 AI 编辑",
11553
12600
  openingAuthor: "正在打开…",
11554
12601
  authorWorldFailed: "无法打开世界编辑对话:{message}",
@@ -11930,10 +12977,10 @@ window.__ModuleLoader__.load({
11930
12977
  }
11931
12978
  tag$5.textContent = css$5;
11932
12979
  var BranchDialog_module_css_default = {
11933
- "form": "rp_Dy1TaW_form",
11934
- "field": "rp_Dy1TaW_field",
11935
12980
  "error": "rp_Dy1TaW_error",
11936
- "label": "rp_Dy1TaW_label"
12981
+ "field": "rp_Dy1TaW_field",
12982
+ "label": "rp_Dy1TaW_label",
12983
+ "form": "rp_Dy1TaW_form"
11937
12984
  };
11938
12985
  //#endregion
11939
12986
  //#region src/client/branch/BranchDialog.tsx
@@ -12076,7 +13123,7 @@ window.__ModuleLoader__.load({
12076
13123
  /** Adds the Gallery tab beside Chat and World: every image of the session in a grid. */
12077
13124
  function registerGallery(ctx) {
12078
13125
  const t = ctx.locale.bind(NAMESPACE$5);
12079
- ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$12), "roleplay: gallery dictionaries");
13126
+ ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$13), "roleplay: gallery dictionaries");
12080
13127
  ctx.inject(["uiConversation"], (scope) => {
12081
13128
  scope.uiConversation.views.register(galleryTarget);
12082
13129
  scope.slots.inject("conversation.view", () => scope.slots.register({
@@ -12402,17 +13449,17 @@ window.__ModuleLoader__.load({
12402
13449
  }
12403
13450
  tag$4.textContent = css$4;
12404
13451
  var SidebarPage_module_css_default = {
12405
- "bar": "rp_Ptco8a_bar",
12406
- "message": "rp_Ptco8a_message",
12407
- "entry": "rp_Ptco8a_entry",
12408
- "name": "rp_Ptco8a_name",
12409
13452
  "icon": "rp_Ptco8a_icon",
12410
- "page": "rp_Ptco8a_page",
12411
- "title": "rp_Ptco8a_title",
12412
- "text": "rp_Ptco8a_text",
12413
13453
  "content": "rp_Ptco8a_content",
13454
+ "text": "rp_Ptco8a_text",
13455
+ "title": "rp_Ptco8a_title",
12414
13456
  "description": "rp_Ptco8a_description",
12415
- "main": "rp_Ptco8a_main"
13457
+ "bar": "rp_Ptco8a_bar",
13458
+ "main": "rp_Ptco8a_main",
13459
+ "entry": "rp_Ptco8a_entry",
13460
+ "message": "rp_Ptco8a_message",
13461
+ "page": "rp_Ptco8a_page",
13462
+ "name": "rp_Ptco8a_name"
12416
13463
  };
12417
13464
  //#endregion
12418
13465
  //#region src/client/interface/SidebarPage.tsx
@@ -12738,26 +13785,26 @@ window.__ModuleLoader__.load({
12738
13785
  }
12739
13786
  tag$3.textContent = css$3;
12740
13787
  var ChatSettingsView_module_css_default = {
12741
- "select": "rp_wLpbxW_select",
12742
- "message": "rp_wLpbxW_message",
12743
- "actions": "rp_wLpbxW_actions",
12744
- "saved": "rp_wLpbxW_saved",
12745
- "activity": "rp_wLpbxW_activity",
13788
+ "run": "rp_wLpbxW_run",
12746
13789
  "table": "rp_wLpbxW_table",
12747
- "label": "rp_wLpbxW_label",
12748
- "description": "rp_wLpbxW_description",
12749
13790
  "error": "rp_wLpbxW_error",
12750
- "run": "rp_wLpbxW_run",
13791
+ "row": "rp_wLpbxW_row",
13792
+ "title": "rp_wLpbxW_title",
12751
13793
  "field": "rp_wLpbxW_field",
13794
+ "saved": "rp_wLpbxW_saved",
13795
+ "link": "rp_wLpbxW_link",
13796
+ "description": "rp_wLpbxW_description",
13797
+ "view": "rp_wLpbxW_view",
13798
+ "reasons": "rp_wLpbxW_reasons",
12752
13799
  "list": "rp_wLpbxW_list",
12753
13800
  "notice": "rp_wLpbxW_notice",
12754
- "reasons": "rp_wLpbxW_reasons",
12755
- "view": "rp_wLpbxW_view",
12756
- "title": "rp_wLpbxW_title",
12757
- "pre": "rp_wLpbxW_pre",
12758
- "link": "rp_wLpbxW_link",
12759
13801
  "help": "rp_wLpbxW_help",
12760
- "row": "rp_wLpbxW_row"
13802
+ "label": "rp_wLpbxW_label",
13803
+ "actions": "rp_wLpbxW_actions",
13804
+ "pre": "rp_wLpbxW_pre",
13805
+ "activity": "rp_wLpbxW_activity",
13806
+ "select": "rp_wLpbxW_select",
13807
+ "message": "rp_wLpbxW_message"
12761
13808
  };
12762
13809
  //#endregion
12763
13810
  //#region src/client/chat-settings/settings-api.ts
@@ -12810,6 +13857,22 @@ window.__ModuleLoader__.load({
12810
13857
  throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
12811
13858
  }
12812
13859
  }
13860
+ /** Opens the session doctor chat of the story, made when it is first asked for. */
13861
+ async function openDoctor(id, title, language, signal) {
13862
+ const response = await fetch(`${API_PREFIX}/sessions/doctor?id=${encodeURIComponent(id)}`, {
13863
+ method: "POST",
13864
+ credentials: "same-origin",
13865
+ headers: { "content-type": "application/json" },
13866
+ body: JSON.stringify({
13867
+ title,
13868
+ language
13869
+ }),
13870
+ signal
13871
+ });
13872
+ const body = await response.json().catch(() => void 0);
13873
+ if (!response.ok || typeof body?.chatSessionId !== "string") throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
13874
+ return body.chatSessionId;
13875
+ }
12813
13876
  /** What a helper run was told and did; nothing when the run was not kept or has been dropped. */
12814
13877
  async function loadRun(id, run, signal) {
12815
13878
  const response = await fetch(`${API_PREFIX}/sessions/activity/run?id=${encodeURIComponent(id)}&run=${encodeURIComponent(run)}`, {
@@ -13310,14 +14373,23 @@ window.__ModuleLoader__.load({
13310
14373
  //#endregion
13311
14374
  //#region src/client/chat-settings/ChatSettingsView.tsx
13312
14375
  /** The settings of one chat. Ordinary DSH chats have ids of the same shape, so the host decides whether this one is a roleplay session. */
13313
- function ChatSettingsView({ t, sessionId }) {
14376
+ function ChatSettingsView({ t, sessionId, openChat }) {
13314
14377
  const session = roleplaySessionOf(sessionId);
13315
14378
  const [load, setLoad] = (0, react.useState)(session === void 0 ? { status: "not-roleplay" } : { status: "loading" });
13316
14379
  const [drafts, setDrafts] = (0, react.useState)({});
13317
14380
  const [saving, setSaving] = (0, react.useState)(false);
13318
14381
  const [saved, setSaved] = (0, react.useState)(false);
13319
14382
  const [error, setError] = (0, react.useState)();
14383
+ const [toolsError, setToolsError] = (0, react.useState)();
14384
+ const [external, setExternal] = (0, react.useState)([]);
13320
14385
  const options = useEmbeddingOptions("all");
14386
+ (0, react.useEffect)(() => {
14387
+ const abort = new AbortController();
14388
+ loadExternalTools(abort.signal).then(setExternal, () => void 0);
14389
+ return () => {
14390
+ abort.abort();
14391
+ };
14392
+ }, []);
13321
14393
  (0, react.useEffect)(() => {
13322
14394
  if (session === void 0) return void 0;
13323
14395
  const abort = new AbortController();
@@ -13374,6 +14446,13 @@ window.__ModuleLoader__.load({
13374
14446
  setError(t("reflectFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
13375
14447
  });
13376
14448
  };
14449
+ const askDoctor = () => {
14450
+ if (session === void 0) return;
14451
+ setError(void 0);
14452
+ openDoctor(session, t("doctorChat"), t("language"), new AbortController().signal).then(openChat, (failure) => {
14453
+ setError(t("doctorFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
14454
+ });
14455
+ };
13377
14456
  const refreshActivity = () => {
13378
14457
  if (session === void 0) return;
13379
14458
  loadSettings(session, new AbortController().signal).then((next) => {
@@ -13393,6 +14472,24 @@ window.__ModuleLoader__.load({
13393
14472
  setError(failure instanceof Error ? failure.message : String(failure));
13394
14473
  });
13395
14474
  };
14475
+ const setTools = (tools) => {
14476
+ if (session === void 0) return;
14477
+ setSaving(true);
14478
+ setToolsError(void 0);
14479
+ saveSettings(session, {
14480
+ ...payload.settings,
14481
+ tools
14482
+ }, new AbortController().signal).then((next) => {
14483
+ setLoad({
14484
+ status: "ready",
14485
+ payload: next
14486
+ });
14487
+ }, (failure) => {
14488
+ setToolsError(failure instanceof Error ? failure.message : String(failure));
14489
+ }).finally(() => {
14490
+ setSaving(false);
14491
+ });
14492
+ };
13396
14493
  const save = () => {
13397
14494
  if (session === void 0 || !changed) return;
13398
14495
  setSaving(true);
@@ -13463,6 +14560,14 @@ window.__ModuleLoader__.load({
13463
14560
  saved: payload.settings.interface.pack,
13464
14561
  disabled: saving
13465
14562
  }),
14563
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolSwitches, {
14564
+ board: payload.settings.tools,
14565
+ onChange: setTools,
14566
+ disabled: saving,
14567
+ external,
14568
+ ...toolsError === void 0 ? {} : { error: toolsError },
14569
+ t
14570
+ }),
13466
14571
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReflectionSection, {
13467
14572
  t,
13468
14573
  status: payload.reflection,
@@ -13470,6 +14575,23 @@ window.__ModuleLoader__.load({
13470
14575
  onStart: reflect,
13471
14576
  onRefresh: refreshActivity
13472
14577
  }),
14578
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
14579
+ className: ChatSettingsView_module_css_default.activity,
14580
+ "data-testid": "roleplay-doctor",
14581
+ children: [
14582
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("doctorTitle") }),
14583
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14584
+ className: ChatSettingsView_module_css_default.description,
14585
+ children: t("doctorHelp")
14586
+ }),
14587
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14588
+ variant: "ghost",
14589
+ size: "sm",
14590
+ onClick: askDoctor,
14591
+ children: t("doctorOpen")
14592
+ }) })
14593
+ ]
14594
+ }),
13473
14595
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VectorsSection, {
13474
14596
  t,
13475
14597
  status: payload.vectors,
@@ -13507,7 +14629,7 @@ window.__ModuleLoader__.load({
13507
14629
  ]
13508
14630
  });
13509
14631
  }
13510
- const dictionaries$2 = withDictionaries({
14632
+ const dictionaries$2 = withDictionaries(withDictionaries({
13511
14633
  en: {
13512
14634
  tab: "Chat settings",
13513
14635
  title: "Chat settings",
@@ -13582,6 +14704,12 @@ window.__ModuleLoader__.load({
13582
14704
  reflectNothing: "No character had enough new to sort.",
13583
14705
  reflectRunning: "The characters are sorting what they took in…",
13584
14706
  reflectNow: "Reflect now",
14707
+ language: "en",
14708
+ doctorTitle: "Session doctor",
14709
+ doctorHelp: "A separate chat where an assistant reads this story's records, looks for what does not fit and proposes fixes. Each change is shown to you for approval before it is made.",
14710
+ doctorOpen: "Open the session doctor",
14711
+ doctorChat: "Session doctor",
14712
+ doctorFailed: "Could not open the session doctor: {message}",
13585
14713
  reflectHelp: "Each character with something new sorts it into what it believes: beliefs are merged, firmed up or let go, each resting on events it took in. It runs in the background; you can keep playing.",
13586
14714
  reflectFailed: "Could not start the reflection: {message}",
13587
14715
  reflectError: "The last pass failed: {message}",
@@ -13684,6 +14812,12 @@ window.__ModuleLoader__.load({
13684
14812
  reflectNothing: "没有角色积攒了足够多的新见闻。",
13685
14813
  reflectRunning: "角色们正在整理所见所闻……",
13686
14814
  reflectNow: "立即反思",
14815
+ language: "zh",
14816
+ doctorTitle: "会话医生",
14817
+ doctorHelp: "一个独立的对话:助手会阅读这个故事的记录,找出对不上的地方并提出修复。每一处修改在执行前都会交给你批准。",
14818
+ doctorOpen: "打开会话医生",
14819
+ doctorChat: "会话医生",
14820
+ doctorFailed: "无法打开会话医生:{message}",
13687
14821
  reflectHelp: "每个有新见闻的角色会把它们整理成自己的信念:合并、巩固或放下,每一条都要依据它接收到的事件。反思在后台进行,你可以继续游玩。",
13688
14822
  reflectFailed: "无法开始反思:{message}",
13689
14823
  reflectError: "上一次反思失败:{message}",
@@ -13712,7 +14846,7 @@ window.__ModuleLoader__.load({
13712
14846
  saved: "已保存。",
13713
14847
  saveFailed: "无法保存设置:{message}"
13714
14848
  }
13715
- }, dictionaries$6);
14849
+ }, dictionaries$6), dictionaries$14);
13716
14850
  //#endregion
13717
14851
  //#region src/client/chat-settings/index.ts
13718
14852
  const NAMESPACE$2 = "roleplay.chatSettings";
@@ -13737,7 +14871,8 @@ window.__ModuleLoader__.load({
13737
14871
  id: VIEW_ID,
13738
14872
  order: 20,
13739
14873
  label: () => t("tab"),
13740
- locale: NAMESPACE$2
14874
+ locale: NAMESPACE$2,
14875
+ inject: () => ({ openChat: createChatOpener(ctx) })
13741
14876
  }, ChatSettingsView));
13742
14877
  });
13743
14878
  }
@@ -13898,10 +15033,12 @@ window.__ModuleLoader__.load({
13898
15033
  const ooc = value["ooc"];
13899
15034
  const ruled = typeof ooc === "object" && ooc !== null && typeof ooc["legal"] === "boolean" && typeof ooc["note"] === "string" ? ooc : void 0;
13900
15035
  const timelineNode = typeof value["timelineNode"] === "string" ? value["timelineNode"] : void 0;
15036
+ const rolls = Array.isArray(value["rolls"]) ? value["rolls"].filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "number" && typeof entry.text === "string" && (entry.by === "agent" || entry.by === "player")) : [];
13901
15037
  return {
13902
15038
  segments,
13903
15039
  repaired: value["repaired"],
13904
15040
  ...ruled === void 0 ? {} : { ooc: ruled },
15041
+ ...rolls.length === 0 ? {} : { rolls },
13905
15042
  ...timelineNode === void 0 ? {} : { timelineNode }
13906
15043
  };
13907
15044
  } catch {
@@ -14017,7 +15154,7 @@ window.__ModuleLoader__.load({
14017
15154
  };
14018
15155
  //#endregion
14019
15156
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/transcript/NarrationView.module.css.mjs
14020
- const css$2 = ".rp_NFPimG_output{flex-direction:column;gap:8px;min-width:0;margin:8px 0;display:flex}.rp_NFPimG_narration{color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:22px}.rp_NFPimG_line{align-items:flex-start;gap:10px;min-width:0;display:flex}.rp_NFPimG_avatar{corner-shape:round;color:#fff;border-radius:14px;flex:none;justify-content:center;align-items:center;width:28px;height:28px;font-size:12px;font-weight:500;display:flex}.rp_NFPimG_speech{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);flex-direction:column;gap:2px;min-width:0;max-width:100%;padding:6px 10px;display:flex}.rp_NFPimG_name{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.rp_NFPimG_words{color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:20px}.rp_NFPimG_note{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_NFPimG_preview{opacity:.8}.rp_NFPimG_oocNote,.rp_NFPimG_oocRefused{border-left:2px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);margin:0;padding:6px 10px;font-size:12px;line-height:18px}.rp_NFPimG_oocRefused{border-left-color:var(--dsw-alias-state-error-primary)}.rp_NFPimG_oocLabel{font-weight:500}.rp_NFPimG_images{flex-direction:column;align-items:flex-start;gap:6px;margin:8px 0 12px;display:flex}.rp_NFPimG_sceneImage{object-fit:contain;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);width:auto;max-width:min(100%,480px);height:auto;max-height:50vh;display:block}.rp_NFPimG_imageButton{cursor:zoom-in;background:0 0;border:0;padding:0}.rp_NFPimG_imageStatus,.rp_NFPimG_imageError{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_NFPimG_imageError{color:var(--dsw-alias-state-error-primary)}.rp_NFPimG_playAll,.rp_NFPimG_playLine{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center}.rp_NFPimG_playAll{float:right;gap:4px;min-height:28px;margin:0 0 8px 12px;padding:2px 4px;font-size:12px;display:inline-flex}.rp_NFPimG_playLine{vertical-align:middle;width:28px;height:28px;margin:-5px -6px -5px 4px;padding:6px;display:inline-flex}.rp_NFPimG_playAll svg,.rp_NFPimG_playLine svg{width:14px;height:14px}.rp_NFPimG_playAll:disabled,.rp_NFPimG_playLine:disabled{cursor:wait;opacity:.5}.rp_NFPimG_playAll:hover,.rp_NFPimG_playLine:hover{color:var(--dsw-alias-label-primary)}.rp_NFPimG_playAll:focus-visible,.rp_NFPimG_playLine:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px;border-radius:var(--dsw-radius-xs)}@media (pointer:coarse){.rp_NFPimG_playAll,.rp_NFPimG_playLine{min-width:44px;min-height:44px}.rp_NFPimG_playLine{width:44px;height:44px;margin-block:-13px}}";
15157
+ const css$2 = ".rp_NFPimG_output{flex-direction:column;gap:8px;min-width:0;margin:8px 0;display:flex}.rp_NFPimG_narration{color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:22px}.rp_NFPimG_line{align-items:flex-start;gap:10px;min-width:0;display:flex}.rp_NFPimG_avatar{corner-shape:round;color:#fff;border-radius:14px;flex:none;justify-content:center;align-items:center;width:28px;height:28px;font-size:12px;font-weight:500;display:flex}.rp_NFPimG_speech{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);flex-direction:column;gap:2px;min-width:0;max-width:100%;padding:6px 10px;display:flex}.rp_NFPimG_name{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.rp_NFPimG_words{color:var(--dsw-alias-label-primary);white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:20px}.rp_NFPimG_note{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_NFPimG_preview{opacity:.8}.rp_NFPimG_oocNote,.rp_NFPimG_oocRefused{border-left:2px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);margin:0;padding:6px 10px;font-size:12px;line-height:18px}.rp_NFPimG_oocRefused{border-left-color:var(--dsw-alias-state-error-primary)}.rp_NFPimG_oocLabel{font-weight:500}.rp_NFPimG_images{flex-direction:column;align-items:flex-start;gap:6px;margin:8px 0 12px;display:flex}.rp_NFPimG_sceneImage{object-fit:contain;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);width:auto;max-width:min(100%,480px);height:auto;max-height:50vh;display:block}.rp_NFPimG_imageButton{cursor:zoom-in;background:0 0;border:0;padding:0}.rp_NFPimG_imageStatus,.rp_NFPimG_imageError{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_NFPimG_imageError{color:var(--dsw-alias-state-error-primary)}.rp_NFPimG_playAll,.rp_NFPimG_playLine{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center}.rp_NFPimG_playAll{float:right;gap:4px;min-height:28px;margin:0 0 8px 12px;padding:2px 4px;font-size:12px;display:inline-flex}.rp_NFPimG_playLine{vertical-align:middle;width:28px;height:28px;margin:-5px -6px -5px 4px;padding:6px;display:inline-flex}.rp_NFPimG_playAll svg,.rp_NFPimG_playLine svg{width:14px;height:14px}.rp_NFPimG_playAll:disabled,.rp_NFPimG_playLine:disabled{cursor:wait;opacity:.5}.rp_NFPimG_playAll:hover,.rp_NFPimG_playLine:hover{color:var(--dsw-alias-label-primary)}.rp_NFPimG_playAll:focus-visible,.rp_NFPimG_playLine:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px;border-radius:var(--dsw-radius-xs)}@media (pointer:coarse){.rp_NFPimG_playAll,.rp_NFPimG_playLine{min-width:44px;min-height:44px}.rp_NFPimG_playLine{width:44px;height:44px;margin-block:-13px}}.rp_NFPimG_dice{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_NFPimG_diceSummary{cursor:pointer;color:var(--dsw-alias-label-secondary)}.rp_NFPimG_diceList{margin:4px 0 0;padding:0 0 0 18px}";
14021
15158
  const key$2 = "src/client/transcript/NarrationView.module.css";
14022
15159
  let tag$2 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$2) + "]");
14023
15160
  if (tag$2 === null) {
@@ -14028,25 +15165,28 @@ window.__ModuleLoader__.load({
14028
15165
  }
14029
15166
  tag$2.textContent = css$2;
14030
15167
  var NarrationView_module_css_default = {
14031
- "name": "rp_NFPimG_name",
14032
- "narration": "rp_NFPimG_narration",
14033
- "note": "rp_NFPimG_note",
14034
- "oocRefused": "rp_NFPimG_oocRefused",
14035
- "line": "rp_NFPimG_line",
14036
- "oocNote": "rp_NFPimG_oocNote",
14037
15168
  "images": "rp_NFPimG_images",
14038
- "sceneImage": "rp_NFPimG_sceneImage",
14039
- "imageButton": "rp_NFPimG_imageButton",
14040
- "playLine": "rp_NFPimG_playLine",
15169
+ "imageError": "rp_NFPimG_imageError",
15170
+ "narration": "rp_NFPimG_narration",
14041
15171
  "playAll": "rp_NFPimG_playAll",
14042
- "speech": "rp_NFPimG_speech",
14043
15172
  "preview": "rp_NFPimG_preview",
14044
- "avatar": "rp_NFPimG_avatar",
15173
+ "speech": "rp_NFPimG_speech",
15174
+ "imageStatus": "rp_NFPimG_imageStatus",
15175
+ "oocLabel": "rp_NFPimG_oocLabel",
15176
+ "oocNote": "rp_NFPimG_oocNote",
15177
+ "imageButton": "rp_NFPimG_imageButton",
14045
15178
  "output": "rp_NFPimG_output",
15179
+ "oocRefused": "rp_NFPimG_oocRefused",
15180
+ "diceSummary": "rp_NFPimG_diceSummary",
15181
+ "line": "rp_NFPimG_line",
15182
+ "name": "rp_NFPimG_name",
15183
+ "dice": "rp_NFPimG_dice",
15184
+ "diceList": "rp_NFPimG_diceList",
14046
15185
  "words": "rp_NFPimG_words",
14047
- "oocLabel": "rp_NFPimG_oocLabel",
14048
- "imageStatus": "rp_NFPimG_imageStatus",
14049
- "imageError": "rp_NFPimG_imageError"
15186
+ "avatar": "rp_NFPimG_avatar",
15187
+ "sceneImage": "rp_NFPimG_sceneImage",
15188
+ "note": "rp_NFPimG_note",
15189
+ "playLine": "rp_NFPimG_playLine"
14050
15190
  };
14051
15191
  //#endregion
14052
15192
  //#region src/client/transcript/PreviewNode.tsx
@@ -14177,6 +15317,21 @@ window.__ModuleLoader__.load({
14177
15317
  })]
14178
15318
  })]
14179
15319
  }, index)),
15320
+ data.rolls !== void 0 && data.rolls.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
15321
+ className: NarrationView_module_css_default.dice,
15322
+ "data-testid": "roleplay-dice",
15323
+ "data-rp": "dice",
15324
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
15325
+ className: NarrationView_module_css_default.diceSummary,
15326
+ children: t("diceRolled", { count: String(data.rolls.length) })
15327
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
15328
+ className: NarrationView_module_css_default.diceList,
15329
+ children: data.rolls.map((roll) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
15330
+ "data-rp": "roll",
15331
+ children: [roll.by === "player" ? `${t("dicePlayer")} ` : "", roll.text]
15332
+ }, roll.id))
15333
+ })]
15334
+ }),
14180
15335
  data.repaired && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14181
15336
  className: NarrationView_module_css_default.note,
14182
15337
  children: t("repaired")
@@ -14296,10 +15451,10 @@ window.__ModuleLoader__.load({
14296
15451
  }
14297
15452
  tag$1.textContent = css$1;
14298
15453
  var SuggestionsDock_module_css_default = {
14299
- "label": "rp_rWH4DG_label",
14300
15454
  "card": "rp_rWH4DG_card",
14301
- "lines": "rp_rWH4DG_lines",
14302
15455
  "dock": "rp_rWH4DG_dock",
15456
+ "label": "rp_rWH4DG_label",
15457
+ "lines": "rp_rWH4DG_lines",
14303
15458
  "chip": "rp_rWH4DG_chip"
14304
15459
  };
14305
15460
  //#endregion
@@ -14324,10 +15479,12 @@ window.__ModuleLoader__.load({
14324
15479
  const [offered, setOffered] = (0, react.useState)([]);
14325
15480
  const [meanwhile, setMeanwhile] = (0, react.useState)([]);
14326
15481
  const [unfinished, setUnfinished] = (0, react.useState)([]);
15482
+ const [unwritten, setUnwritten] = (0, react.useState)(0);
14327
15483
  (0, react.useEffect)(() => {
14328
15484
  setOffered([]);
14329
15485
  setMeanwhile([]);
14330
15486
  setUnfinished([]);
15487
+ setUnwritten(0);
14331
15488
  if (latest === void 0) return void 0;
14332
15489
  let stopped = false;
14333
15490
  let timer;
@@ -14338,9 +15495,11 @@ window.__ModuleLoader__.load({
14338
15495
  setMeanwhile((previous) => previous.join("\n") === away.join("\n") ? previous : away);
14339
15496
  const world = found.find((note) => note.kind === "world")?.lines ?? [];
14340
15497
  setUnfinished((previous) => previous.join("\n") === world.join("\n") ? previous : world);
15498
+ const waiting = found.find((note) => note.kind === "unwritten")?.count ?? 0;
15499
+ setUnwritten(waiting);
14341
15500
  const lines = found.find((note) => note.kind === "suggestions")?.lines;
14342
15501
  if (lines !== void 0 && lines.length > 0) setOffered(lines);
14343
- else if (attempt < GIVE_UP_AFTER) timer = setTimeout(() => {
15502
+ if ((lines === void 0 || lines.length === 0 || waiting > 0) && attempt < GIVE_UP_AFTER) timer = setTimeout(() => {
14344
15503
  look(attempt + 1);
14345
15504
  }, POLL_MS);
14346
15505
  }).catch((error) => {
@@ -14353,12 +15512,17 @@ window.__ModuleLoader__.load({
14353
15512
  if (timer !== void 0) clearTimeout(timer);
14354
15513
  };
14355
15514
  }, [latest, notes]);
14356
- if (running || offered.length === 0 && meanwhile.length === 0 && unfinished.length === 0) return null;
15515
+ if (running || offered.length === 0 && meanwhile.length === 0 && unfinished.length === 0 && unwritten === 0) return null;
14357
15516
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14358
15517
  className: SuggestionsDock_module_css_default.dock,
14359
15518
  "data-testid": "roleplay-suggestions",
14360
15519
  "data-rp": "suggestions",
14361
15520
  children: [
15521
+ unwritten > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
15522
+ className: SuggestionsDock_module_css_default.label,
15523
+ "data-testid": "roleplay-unwritten",
15524
+ children: t("unwritten", { count: unwritten })
15525
+ }),
14362
15526
  unfinished.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14363
15527
  className: SuggestionsDock_module_css_default.card,
14364
15528
  "data-testid": "roleplay-world-findings",
@@ -14411,12 +15575,12 @@ window.__ModuleLoader__.load({
14411
15575
  }
14412
15576
  tag.textContent = css;
14413
15577
  var TurnsDock_module_css_default = {
14414
- "select": "rp_f4YLlq_select",
14415
- "error": "rp_f4YLlq_error",
14416
- "dock": "rp_f4YLlq_dock",
14417
15578
  "button": "rp_f4YLlq_button",
15579
+ "select": "rp_f4YLlq_select",
14418
15580
  "group": "rp_f4YLlq_group",
14419
- "count": "rp_f4YLlq_count"
15581
+ "count": "rp_f4YLlq_count",
15582
+ "error": "rp_f4YLlq_error",
15583
+ "dock": "rp_f4YLlq_dock"
14420
15584
  };
14421
15585
  //#endregion
14422
15586
  //#region src/client/transcript/withdrawn.ts
@@ -14605,6 +15769,7 @@ window.__ModuleLoader__.load({
14605
15769
  //#region src/client/transcript/locales.ts
14606
15770
  const dictionaries = {
14607
15771
  en: {
15772
+ unwritten: "{count} round(s) not yet written into the story's memory",
14608
15773
  speakAll: "Play narration",
14609
15774
  speakLine: "Play this line",
14610
15775
  speaking: "Generating speech…",
@@ -14639,9 +15804,12 @@ window.__ModuleLoader__.load({
14639
15804
  imageDialog: "Illustration",
14640
15805
  imageClose: "Close",
14641
15806
  imageReusable: "Reusable",
14642
- imageUploaded: "Uploaded"
15807
+ imageUploaded: "Uploaded",
15808
+ diceRolled: "Dice rolled: {count}",
15809
+ dicePlayer: "You rolled:"
14643
15810
  },
14644
15811
  zh: {
15812
+ unwritten: "有 {count} 个回合尚未写入故事记忆",
14645
15813
  speakAll: "播放整段",
14646
15814
  speakLine: "播放这句台词",
14647
15815
  speaking: "正在生成语音…",
@@ -14676,7 +15844,9 @@ window.__ModuleLoader__.load({
14676
15844
  imageDialog: "插图",
14677
15845
  imageClose: "关闭",
14678
15846
  imageReusable: "可复用",
14679
- imageUploaded: "已上传"
15847
+ imageUploaded: "已上传",
15848
+ diceRolled: "掷骰:{count}",
15849
+ dicePlayer: "你掷出:"
14680
15850
  }
14681
15851
  };
14682
15852
  //#endregion