@dsh-agentic-roleplay/core 0.1.1 → 0.3.0

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 (52) hide show
  1. package/README.md +1 -1
  2. package/lib/{chat-AKrVcWIC.js → access-EbNdZFbk.js} +10 -2
  3. package/lib/authoring.js +469 -17
  4. package/lib/client.js +3013 -607
  5. package/lib/client.js.map +1 -1
  6. package/lib/compaction.js +2 -3
  7. package/lib/{activity-BbqFG9-3.js → deliver--uMhC6oO.js} +741 -55
  8. package/lib/{documents-ZVoUTnD2.js → documents-7GMc5NnW.js} +108 -5
  9. package/lib/{gallery-KGCdeCnM.js → gallery-DUeBMHQX.js} +2 -2
  10. package/lib/{generator-NYnNdpWb.js → generator-HPifO3Kk.js} +125 -20
  11. package/lib/images.js +3 -3
  12. package/lib/index.js +865 -15
  13. package/lib/{narration-DcnCqA1l.js → narration-CKZTk5UE.js} +19 -4
  14. package/lib/orchestration.js +373 -207
  15. package/lib/packs-alJTiDM2.js +1336 -0
  16. package/lib/{presenter-agent-7j1c7QEz.js → presenter-agent-PX1WVaJB.js} +4 -4
  17. package/package.json +5 -3
  18. package/packs/scene/map.html +12 -0
  19. package/packs/scene/map.js +55 -0
  20. package/packs/scene/pack.json +11 -0
  21. package/packs/scene/strip.html +11 -0
  22. package/packs/scene/strip.js +26 -0
  23. package/packs/scene/style.css +16 -0
  24. package/prompts/en/roleplay/ask-answerer.md +3 -0
  25. package/prompts/en/roleplay/ask-question.md +2 -0
  26. package/prompts/en/roleplay/character-decide.md +1 -1
  27. package/prompts/en/roleplay/character-lookup.md +1 -1
  28. package/prompts/en/roleplay/game-master.md +5 -1
  29. package/prompts/en/roleplay/ooc-empty.md +1 -1
  30. package/prompts/en/roleplay/reflection.md +9 -0
  31. package/prompts/en/world/procedure.md +1 -1
  32. package/prompts/en/world/welcome.md +1 -1
  33. package/prompts/zh/roleplay/ask-answerer.md +3 -0
  34. package/prompts/zh/roleplay/ask-question.md +2 -0
  35. package/prompts/zh/roleplay/character-decide.md +1 -1
  36. package/prompts/zh/roleplay/character-lookup.md +1 -1
  37. package/prompts/zh/roleplay/game-master.md +5 -1
  38. package/prompts/zh/roleplay/ooc-empty.md +1 -1
  39. package/prompts/zh/roleplay/reflection.md +9 -0
  40. package/prompts/zh/world/procedure.md +1 -1
  41. package/prompts/zh/world/welcome.md +1 -1
  42. package/starter-worlds/blackwater-observatory/ui/notebook/map.html +12 -0
  43. package/starter-worlds/blackwater-observatory/ui/notebook/map.js +40 -0
  44. package/starter-worlds/blackwater-observatory/ui/notebook/notebook.html +29 -0
  45. package/starter-worlds/blackwater-observatory/ui/notebook/notebook.js +45 -0
  46. package/starter-worlds/blackwater-observatory/ui/notebook/pack.json +31 -0
  47. package/starter-worlds/blackwater-observatory/ui/notebook/skin.css +16 -0
  48. package/starter-worlds/blackwater-observatory/ui/notebook/strip.html +11 -0
  49. package/starter-worlds/blackwater-observatory/ui/notebook/strip.js +12 -0
  50. package/starter-worlds/blackwater-observatory/ui/notebook/style.css +23 -0
  51. package/lib/access-C1nFQiyT.js +0 -12
  52. package/lib/worlds-DYgjdH8O.js +0 -504
package/lib/client.js CHANGED
@@ -9,6 +9,7 @@ window.__ModuleLoader__.load({
9
9
  let react = require("react");
10
10
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
11
11
  let _deepseek_ai_dsh_client_ui_slots = require("@deepseek-ai/dsh-client-ui-slots");
12
+ let react_dom = require("react-dom");
12
13
  //#region src/shared/ids.ts
13
14
  /**
14
15
  * Profile entry id of the core plugin's row. Settings forms are addressed by
@@ -25,19 +26,19 @@ window.__ModuleLoader__.load({
25
26
  }
26
27
  //#endregion
27
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
28
- const css$21 = ".rp_Poldga_tabs{gap:24px;margin-bottom:-1px;display:flex}.rp_Poldga_tab{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;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)}";
29
- const key$21 = "src/client/panel/PageTabs.module.css";
30
- let tag$21 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$21) + "]");
31
- if (tag$21 === null) {
32
- tag$21 = document.createElement("style");
33
- tag$21.dataset.plugin = "@dsh-agentic-roleplay/core";
34
- tag$21.dataset.pluginCss = key$21;
35
- document.head.appendChild(tag$21);
36
- }
37
- tag$21.textContent = css$21;
29
+ const css$24 = ".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$24 = "src/client/panel/PageTabs.module.css";
31
+ let tag$24 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$24) + "]");
32
+ if (tag$24 === null) {
33
+ tag$24 = document.createElement("style");
34
+ tag$24.dataset.plugin = "@dsh-agentic-roleplay/core";
35
+ tag$24.dataset.pluginCss = key$24;
36
+ document.head.appendChild(tag$24);
37
+ }
38
+ tag$24.textContent = css$24;
38
39
  var PageTabs_module_css_default = {
39
- "tab": "rp_Poldga_tab",
40
- "tabs": "rp_Poldga_tabs"
40
+ "tabs": "rp_Poldga_tabs",
41
+ "tab": "rp_Poldga_tab"
41
42
  };
42
43
  //#endregion
43
44
  //#region src/client/panel/PageTabs.tsx
@@ -81,20 +82,20 @@ window.__ModuleLoader__.load({
81
82
  }
82
83
  //#endregion
83
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
84
- const css$20 = ".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:1px 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}";
85
- const key$20 = "src/client/panel/RoleplayPanel.module.css";
86
- let tag$20 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$20) + "]");
87
- if (tag$20 === null) {
88
- tag$20 = document.createElement("style");
89
- tag$20.dataset.plugin = "@dsh-agentic-roleplay/core";
90
- tag$20.dataset.pluginCss = key$20;
91
- document.head.appendChild(tag$20);
92
- }
93
- tag$20.textContent = css$20;
85
+ const css$23 = ".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$23 = "src/client/panel/RoleplayPanel.module.css";
87
+ let tag$23 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$23) + "]");
88
+ if (tag$23 === null) {
89
+ tag$23 = document.createElement("style");
90
+ tag$23.dataset.plugin = "@dsh-agentic-roleplay/core";
91
+ tag$23.dataset.pluginCss = key$23;
92
+ document.head.appendChild(tag$23);
93
+ }
94
+ tag$23.textContent = css$23;
94
95
  var RoleplayPanel_module_css_default = {
95
- "title": "rp_ua5gBa_title",
96
96
  "panel": "rp_ua5gBa_panel",
97
97
  "body": "rp_ua5gBa_body",
98
+ "title": "rp_ua5gBa_title",
98
99
  "header": "rp_ua5gBa_header"
99
100
  };
100
101
  //#endregion
@@ -142,7 +143,7 @@ window.__ModuleLoader__.load({
142
143
  }
143
144
  //#endregion
144
145
  //#region src/client/panel/locales.ts
145
- const dictionaries$10 = {
146
+ const dictionaries$13 = {
146
147
  en: {
147
148
  label: "Role Play",
148
149
  heading: "DSH Agentic Role Play",
@@ -199,11 +200,11 @@ window.__ModuleLoader__.load({
199
200
  }
200
201
  //#endregion
201
202
  //#region src/client/panel/index.ts
202
- const NAMESPACE$9 = "roleplay.panel";
203
+ const NAMESPACE$10 = "roleplay.panel";
203
204
  /** Adds the Role Play entry to the sidebar and the main panel it opens. */
204
205
  function registerPanel(ctx) {
205
- const t = ctx.locale.bind(NAMESPACE$9);
206
- ctx.effect(() => ctx.locale.register(NAMESPACE$9, dictionaries$10), "roleplay: panel dictionaries");
206
+ const t = ctx.locale.bind(NAMESPACE$10);
207
+ ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$13), "roleplay: panel dictionaries");
207
208
  const pages = createPagesSource(ctx);
208
209
  ctx.effect(() => pages.start(), "roleplay: page list");
209
210
  const handle = createPanelStore();
@@ -215,7 +216,7 @@ window.__ModuleLoader__.load({
215
216
  ctx.slots.inject("main", () => ctx.slots.register({
216
217
  name: "main",
217
218
  key: PANEL_ID,
218
- locale: NAMESPACE$9,
219
+ locale: NAMESPACE$10,
219
220
  store,
220
221
  inject: () => ({ hooks: { pages: pages.store } }),
221
222
  children: { "roleplay.page": {
@@ -228,7 +229,7 @@ window.__ModuleLoader__.load({
228
229
  id: PANEL_ID,
229
230
  order: 5,
230
231
  label: () => t("label"),
231
- locale: NAMESPACE$9
232
+ locale: NAMESPACE$10
232
233
  }, PanelIcon));
233
234
  }
234
235
  //#endregion
@@ -733,53 +734,100 @@ window.__ModuleLoader__.load({
733
734
  const isDirty = (character, draft) => Object.keys(editOf$1(character, draft)).length > 0;
734
735
  //#endregion
735
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
736
- const css$19 = ".rp_5ZMIxq_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_5ZMIxq_tabs{border-bottom:1px 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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:150px;height:auto;display:block}.rp_5ZMIxq_portraitBox{border-radius:var(--dsw-radius-sm);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-sm) var(--dsw-radius-sm);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:1px 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:1px 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{font-size:16px;font-weight:500}.rp_5ZMIxq_row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_grid{grid-template-columns:repeat(auto-fill,minmax(160px,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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:100%;min-height:32px;color:inherit;font:inherit;background:0 0;padding:4px 8px;font-size:13px}.rp_5ZMIxq_area{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:100%;color:inherit;font:inherit;resize:vertical;background:0 0;padding:6px 8px;font-size:13px;line-height:20px}.rp_5ZMIxq_goal{border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);flex-direction:column;gap:8px;padding:10px;display:flex}.rp_5ZMIxq_row>.rp_5ZMIxq_select{width:auto;min-width:110px}";
737
- const key$19 = "src/client/world-editor/CharactersPanel.module.css";
738
- let tag$19 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$19) + "]");
739
- if (tag$19 === null) {
740
- tag$19 = document.createElement("style");
741
- tag$19.dataset.plugin = "@dsh-agentic-roleplay/core";
742
- tag$19.dataset.pluginCss = key$19;
743
- document.head.appendChild(tag$19);
744
- }
745
- tag$19.textContent = css$19;
737
+ const css$22 = ".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$22 = "src/client/world-editor/CharactersPanel.module.css";
739
+ let tag$22 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$22) + "]");
740
+ if (tag$22 === null) {
741
+ tag$22 = document.createElement("style");
742
+ tag$22.dataset.plugin = "@dsh-agentic-roleplay/core";
743
+ tag$22.dataset.pluginCss = key$22;
744
+ document.head.appendChild(tag$22);
745
+ }
746
+ tag$22.textContent = css$22;
746
747
  var CharactersPanel_module_css_default = {
747
- "missing": "rp_5ZMIxq_missing",
748
- "nameInput": "rp_5ZMIxq_nameInput",
749
- "tabsSpace": "rp_5ZMIxq_tabsSpace",
750
- "portraitAction": "rp_5ZMIxq_portraitAction",
751
- "empty": "rp_5ZMIxq_empty",
752
- "portraitHint": "rp_5ZMIxq_portraitHint",
753
- "panel": "rp_5ZMIxq_panel",
754
- "placeholder": "rp_5ZMIxq_placeholder",
755
- "grid": "rp_5ZMIxq_grid",
748
+ "help": "rp_5ZMIxq_help",
749
+ "field": "rp_5ZMIxq_field",
756
750
  "portraitBox": "rp_5ZMIxq_portraitBox",
751
+ "area": "rp_5ZMIxq_area",
752
+ "placeholder": "rp_5ZMIxq_placeholder",
753
+ "bar": "rp_5ZMIxq_bar",
757
754
  "tabs": "rp_5ZMIxq_tabs",
758
- "field": "rp_5ZMIxq_field",
759
755
  "meta": "rp_5ZMIxq_meta",
760
- "sectionTitle": "rp_5ZMIxq_sectionTitle",
761
- "section": "rp_5ZMIxq_section",
762
- "portraitError": "rp_5ZMIxq_portraitError",
763
- "area": "rp_5ZMIxq_area",
764
- "goal": "rp_5ZMIxq_goal",
765
756
  "error": "rp_5ZMIxq_error",
766
- "barText": "rp_5ZMIxq_barText",
757
+ "initial": "rp_5ZMIxq_initial",
758
+ "nameInput": "rp_5ZMIxq_nameInput",
759
+ "row": "rp_5ZMIxq_row",
760
+ "portrait": "rp_5ZMIxq_portrait",
761
+ "missing": "rp_5ZMIxq_missing",
762
+ "empty": "rp_5ZMIxq_empty",
767
763
  "body": "rp_5ZMIxq_body",
764
+ "tabsSpace": "rp_5ZMIxq_tabsSpace",
765
+ "select": "rp_5ZMIxq_select",
766
+ "head": "rp_5ZMIxq_head",
767
+ "section": "rp_5ZMIxq_section",
768
+ "sectionTitle": "rp_5ZMIxq_sectionTitle",
768
769
  "voiceInline": "rp_5ZMIxq_voiceInline",
769
- "tab": "rp_5ZMIxq_tab",
770
+ "barText": "rp_5ZMIxq_barText",
771
+ "portraitError": "rp_5ZMIxq_portraitError",
772
+ "grid": "rp_5ZMIxq_grid",
773
+ "wide": "rp_5ZMIxq_wide",
770
774
  "sheet": "rp_5ZMIxq_sheet",
771
- "row": "rp_5ZMIxq_row",
775
+ "portraitAction": "rp_5ZMIxq_portraitAction",
772
776
  "label": "rp_5ZMIxq_label",
773
777
  "tabOn": "rp_5ZMIxq_tabOn",
774
- "help": "rp_5ZMIxq_help",
775
- "select": "rp_5ZMIxq_select",
776
- "portrait": "rp_5ZMIxq_portrait",
777
- "head": "rp_5ZMIxq_head",
778
- "wide": "rp_5ZMIxq_wide",
779
- "bar": "rp_5ZMIxq_bar",
780
- "initial": "rp_5ZMIxq_initial"
778
+ "panel": "rp_5ZMIxq_panel",
779
+ "tab": "rp_5ZMIxq_tab",
780
+ "portraitHint": "rp_5ZMIxq_portraitHint",
781
+ "goal": "rp_5ZMIxq_goal"
781
782
  };
782
783
  //#endregion
784
+ //#region src/client/world-editor/EditorTabs.tsx
785
+ /** Adds expected arrow, Home and End navigation to an existing editor tab strip. */
786
+ function navigateEditorTabs(event) {
787
+ if (event.defaultPrevented || !(event.target instanceof HTMLButtonElement) || event.target.getAttribute("role") !== "tab") return;
788
+ const tablist = event.target.closest("[role=\"tablist\"]");
789
+ if (tablist === null || !event.currentTarget.contains(tablist)) return;
790
+ const tabs = [...tablist.querySelectorAll("[role=\"tab\"]")];
791
+ const index = tabs.indexOf(event.target);
792
+ const last = tabs.length - 1;
793
+ const target = event.key === "ArrowLeft" ? index === 0 ? last : index - 1 : event.key === "ArrowRight" ? index === last ? 0 : index + 1 : event.key === "Home" ? 0 : event.key === "End" ? last : void 0;
794
+ if (target === void 0 || tabs[target] === void 0) return;
795
+ event.preventDefault();
796
+ tabs[target].focus();
797
+ tabs[target].click();
798
+ }
799
+ /** A horizontally scrollable editor tab strip with the keyboard behaviour expected of ARIA tabs. */
800
+ function EditorTabs({ tabs, value, label, onChange, children }) {
801
+ const move = (event, index) => {
802
+ if (event.defaultPrevented) return;
803
+ const last = tabs.length - 1;
804
+ const target = event.key === "ArrowLeft" ? index === 0 ? last : index - 1 : event.key === "ArrowRight" ? index === last ? 0 : index + 1 : event.key === "Home" ? 0 : event.key === "End" ? last : void 0;
805
+ if (target === void 0 || tabs[target] === void 0) return;
806
+ event.preventDefault();
807
+ onChange(tabs[target].key);
808
+ event.currentTarget.parentElement?.querySelectorAll("[role=\"tab\"]")[target]?.focus();
809
+ };
810
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
811
+ className: CharactersPanel_module_css_default.tabs,
812
+ role: "tablist",
813
+ "aria-label": label,
814
+ children: [tabs.map((tab, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
815
+ type: "button",
816
+ role: "tab",
817
+ "aria-selected": tab.key === value,
818
+ tabIndex: tab.key === value ? 0 : -1,
819
+ className: `${CharactersPanel_module_css_default.tab} ${tab.key === value ? CharactersPanel_module_css_default.tabOn : ""}`,
820
+ onClick: () => {
821
+ onChange(tab.key);
822
+ },
823
+ onKeyDown: (event) => {
824
+ move(event, index);
825
+ },
826
+ children: tab.label
827
+ }, tab.key)), children]
828
+ });
829
+ }
830
+ //#endregion
783
831
  //#region src/client/world-editor/CharactersPanel.tsx
784
832
  /** A steady colour per name, for a portrait that does not exist yet. */
785
833
  function hueOf$3(name) {
@@ -799,7 +847,9 @@ window.__ModuleLoader__.load({
799
847
  children: [character.portrait !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
800
848
  className: CharactersPanel_module_css_default.portrait,
801
849
  src: character.portrait,
802
- alt: ""
850
+ alt: "",
851
+ loading: "lazy",
852
+ decoding: "async"
803
853
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
804
854
  className: `${CharactersPanel_module_css_default.portrait} ${CharactersPanel_module_css_default.placeholder}`,
805
855
  style: { background: `hsl(${hueOf$3(character.name)} 22% 88%)` },
@@ -1327,11 +1377,13 @@ window.__ModuleLoader__.load({
1327
1377
  className: CharactersPanel_module_css_default.tabs,
1328
1378
  role: "tablist",
1329
1379
  "aria-label": t("characters"),
1380
+ onKeyDown: navigateEditorTabs,
1330
1381
  children: [
1331
1382
  world.characters.map((character) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1332
1383
  type: "button",
1333
1384
  role: "tab",
1334
1385
  "aria-selected": character.key === current.key,
1386
+ tabIndex: character.key === current.key ? 0 : -1,
1335
1387
  className: `${CharactersPanel_module_css_default.tab} ${character.key === current.key ? CharactersPanel_module_css_default.tabOn : ""}`,
1336
1388
  onClick: () => {
1337
1389
  setChosen(character.key);
@@ -1453,23 +1505,15 @@ window.__ModuleLoader__.load({
1453
1505
  ...globalId.trim() === "" ? {} : { globalId: globalId.trim() }
1454
1506
  };
1455
1507
  function Tabs({ entries, chosen, choose, actions }) {
1456
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1457
- className: CharactersPanel_module_css_default.tabs,
1458
- role: "tablist",
1459
- children: [
1460
- entries.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1461
- type: "button",
1462
- role: "tab",
1463
- "aria-selected": entry.key === chosen,
1464
- className: `${CharactersPanel_module_css_default.tab} ${entry.key === chosen ? CharactersPanel_module_css_default.tabOn : ""}`,
1465
- onClick: () => {
1466
- choose(entry.key);
1467
- },
1468
- children: entry.name
1469
- }, entry.key)),
1470
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }),
1471
- actions
1472
- ]
1508
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EditorTabs, {
1509
+ tabs: entries.map((entry) => ({
1510
+ key: entry.key,
1511
+ label: entry.name
1512
+ })),
1513
+ value: chosen ?? "",
1514
+ label: entries.find((entry) => entry.key === chosen)?.name ?? entries[0]?.name ?? "",
1515
+ onChange: choose,
1516
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }), actions]
1473
1517
  });
1474
1518
  }
1475
1519
  function SaveBar({ t, dirty, status, save, reset }) {
@@ -2335,50 +2379,50 @@ window.__ModuleLoader__.load({
2335
2379
  }
2336
2380
  //#endregion
2337
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
2338
- const css$18 = ".rp_7pEHTW_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex;position:relative}.rp_7pEHTW_toolbar{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:4px;padding:8px 16px;display:flex}.rp_7pEHTW_filter{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:5px 9px}.rp_7pEHTW_filterOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2)}.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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);max-width:150px;color:inherit;background:0 0;padding:4px 6px}.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:1px solid var(--dsw-alias-border-l3);overflow-y:auto}.rp_7pEHTW_edge{border:0;border-bottom:1px solid var(--dsw-alias-border-l4);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:100%;color:inherit;font:inherit;background:0 0;padding:7px 9px}.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:1px solid var(--dsw-alias-border-l4);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:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:min(480px,100% - 40px);max-height:62%;padding:18px;position:absolute;bottom:20px;right:20px;overflow-y:auto;box-shadow:0 8px 30px #0000002e}@media (width<=760px){.rp_7pEHTW_workspace{grid-template-columns:1fr}.rp_7pEHTW_list{border-right:0;border-bottom:1px solid var(--dsw-alias-border-l3);max-height:220px}.rp_7pEHTW_metrics{grid-template-columns:repeat(2,1fr)}}";
2339
- const key$18 = "src/client/world-editor/RelationsPanel.module.css";
2340
- let tag$18 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$18) + "]");
2341
- if (tag$18 === null) {
2342
- tag$18 = document.createElement("style");
2343
- tag$18.dataset.plugin = "@dsh-agentic-roleplay/core";
2344
- tag$18.dataset.pluginCss = key$18;
2345
- document.head.appendChild(tag$18);
2382
+ const css$21 = ".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$21 = "src/client/world-editor/RelationsPanel.module.css";
2384
+ let tag$21 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$21) + "]");
2385
+ if (tag$21 === null) {
2386
+ tag$21 = document.createElement("style");
2387
+ tag$21.dataset.plugin = "@dsh-agentic-roleplay/core";
2388
+ tag$21.dataset.pluginCss = key$21;
2389
+ document.head.appendChild(tag$21);
2346
2390
  }
2347
- tag$18.textContent = css$18;
2391
+ tag$21.textContent = css$21;
2348
2392
  var RelationsPanel_module_css_default = {
2349
- "space": "rp_7pEHTW_space",
2350
- "perspective": "rp_7pEHTW_perspective",
2351
- "edgeKind": "rp_7pEHTW_edgeKind",
2393
+ "filter": "rp_7pEHTW_filter",
2394
+ "check": "rp_7pEHTW_check",
2352
2395
  "head": "rp_7pEHTW_head",
2353
- "form": "rp_7pEHTW_form",
2354
- "actions": "rp_7pEHTW_actions",
2355
- "graphInspector": "rp_7pEHTW_graphInspector",
2396
+ "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2356
2397
  "graph": "rp_7pEHTW_graph",
2398
+ "space": "rp_7pEHTW_space",
2399
+ "workspace": "rp_7pEHTW_workspace",
2400
+ "node_item": "rp_7pEHTW_node_item",
2401
+ "list": "rp_7pEHTW_list",
2402
+ "node_faction": "rp_7pEHTW_node_faction",
2403
+ "graphInspector": "rp_7pEHTW_graphInspector",
2357
2404
  "node_location": "rp_7pEHTW_node_location",
2405
+ "notice": "rp_7pEHTW_notice",
2406
+ "filterOn": "rp_7pEHTW_filterOn",
2407
+ "empty": "rp_7pEHTW_empty",
2408
+ "error": "rp_7pEHTW_error",
2409
+ "actions": "rp_7pEHTW_actions",
2410
+ "toolbar": "rp_7pEHTW_toolbar",
2358
2411
  "node": "rp_7pEHTW_node",
2359
2412
  "entities": "rp_7pEHTW_entities",
2360
- "node_item": "rp_7pEHTW_node_item",
2361
- "node_faction": "rp_7pEHTW_node_faction",
2362
- "filter": "rp_7pEHTW_filter",
2363
- "status": "rp_7pEHTW_status",
2364
- "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2365
- "edgeOn": "rp_7pEHTW_edgeOn",
2366
- "metrics": "rp_7pEHTW_metrics",
2413
+ "graphEdge": "rp_7pEHTW_graphEdge",
2367
2414
  "edgeTitle": "rp_7pEHTW_edgeTitle",
2368
- "error": "rp_7pEHTW_error",
2415
+ "metrics": "rp_7pEHTW_metrics",
2416
+ "perspective": "rp_7pEHTW_perspective",
2369
2417
  "panel": "rp_7pEHTW_panel",
2370
2418
  "edge": "rp_7pEHTW_edge",
2371
- "notice": "rp_7pEHTW_notice",
2372
- "empty": "rp_7pEHTW_empty",
2373
- "wide": "rp_7pEHTW_wide",
2419
+ "edgeOn": "rp_7pEHTW_edgeOn",
2420
+ "edgeKind": "rp_7pEHTW_edgeKind",
2421
+ "form": "rp_7pEHTW_form",
2374
2422
  "inspector": "rp_7pEHTW_inspector",
2375
- "list": "rp_7pEHTW_list",
2376
- "graphEdge": "rp_7pEHTW_graphEdge",
2377
- "toolbar": "rp_7pEHTW_toolbar",
2378
- "check": "rp_7pEHTW_check",
2379
- "workspace": "rp_7pEHTW_workspace",
2380
2423
  "node_character": "rp_7pEHTW_node_character",
2381
- "filterOn": "rp_7pEHTW_filterOn"
2424
+ "status": "rp_7pEHTW_status",
2425
+ "wide": "rp_7pEHTW_wide"
2382
2426
  };
2383
2427
  //#endregion
2384
2428
  //#region src/client/world-editor/RelationsPanel.tsx
@@ -3502,8 +3546,410 @@ window.__ModuleLoader__.load({
3502
3546
  });
3503
3547
  }
3504
3548
  //#endregion
3549
+ //#region src/shared/interface-pack.ts
3550
+ /** The places in the interface that take a surface. */
3551
+ const SURFACE_NAMES = [
3552
+ "hud",
3553
+ "dock",
3554
+ "opening",
3555
+ "backdrop",
3556
+ "tab",
3557
+ "sidebar"
3558
+ ];
3559
+ /** The surfaces that sit in a strip of the chat and so have a height of their own, with the heights they may ask for. */
3560
+ const STRIP_HEIGHTS = {
3561
+ hud: {
3562
+ min: 24,
3563
+ max: 320,
3564
+ fallback: 56
3565
+ },
3566
+ dock: {
3567
+ min: 24,
3568
+ max: 320,
3569
+ fallback: 48
3570
+ },
3571
+ opening: {
3572
+ min: 120,
3573
+ max: 640,
3574
+ fallback: 320
3575
+ }
3576
+ };
3577
+ const isStrip = (name) => name in STRIP_HEIGHTS;
3578
+ const PACK_LIMITS = {
3579
+ files: 200,
3580
+ bytes: 5242880,
3581
+ fileBytes: 1048576,
3582
+ depth: 4,
3583
+ storageBytes: 65536,
3584
+ history: {
3585
+ fallback: 20,
3586
+ max: 100
3587
+ }
3588
+ };
3589
+ //#endregion
3590
+ //#region src/client/widgets/pack-frame/frame-api.ts
3591
+ const enc$1 = encodeURIComponent;
3592
+ async function read$3(response, what) {
3593
+ if (!response.ok) throw new Error((await response.json().catch(() => ({}))).message ?? `${what} (${response.status})`);
3594
+ return await response.json();
3595
+ }
3596
+ const backends = /* @__PURE__ */ new Map();
3597
+ /** The turns and the keeping of a roleplay session; the same object for the same session, so that a frame keeps its bridge. */
3598
+ const sessionBackend = (session) => backends.get(session) ?? made(session);
3599
+ const made = (session) => {
3600
+ const backend = created(session);
3601
+ backends.set(session, backend);
3602
+ return backend;
3603
+ };
3604
+ const created = (session) => ({
3605
+ history: async (limit) => read$3(await fetch(`roleplay-api/sessions/interface/history?id=${enc$1(session)}&limit=${limit}`), "the story so far could not be read"),
3606
+ storage: async (op, key, value) => (await read$3(await fetch(`roleplay-api/sessions/interface/storage?id=${enc$1(session)}`, {
3607
+ method: "POST",
3608
+ headers: { "content-type": "application/json" },
3609
+ body: JSON.stringify({
3610
+ op,
3611
+ key,
3612
+ ...value === void 0 ? {} : { value }
3613
+ })
3614
+ }), "the pack could not keep that")).value
3615
+ });
3616
+ /** The address of a surface of the pack: its files are found beside it by their relative addresses, so the key stands in the path. */
3617
+ const frameAddress = (key, file, revision) => `roleplay-api/sessions/interface/frame/${enc$1(key)}/${file.split("/").map(enc$1).join("/")}?r=${enc$1(revision)}`;
3618
+ /** The longest words a surface may send as the player. */
3619
+ const MAX_WORDS = 2e3;
3620
+ /** How long a surface waits before it may speak again when the turn does not move. */
3621
+ const SAY_AGAIN_AFTER_MS = 3e4;
3622
+ /** Reads what came through `postMessage`; anything that is not the protocol is nothing. */
3623
+ function parseFrameMessage(data) {
3624
+ if (typeof data !== "object" || data === null) return void 0;
3625
+ const message = data;
3626
+ if (message["rp"] !== 1) return void 0;
3627
+ if (message["type"] === "hello") return { type: "hello" };
3628
+ if (message["type"] === "resize") return typeof message["height"] === "number" && Number.isFinite(message["height"]) ? {
3629
+ type: "resize",
3630
+ height: message["height"]
3631
+ } : void 0;
3632
+ if (message["type"] === "request" && typeof message["id"] === "number" && typeof message["method"] === "string") {
3633
+ const params = message["params"];
3634
+ return {
3635
+ type: "request",
3636
+ id: message["id"],
3637
+ method: message["method"],
3638
+ params: typeof params === "object" && params !== null && !Array.isArray(params) ? params : {}
3639
+ };
3640
+ }
3641
+ }
3642
+ /** The height a surface may ask for, as the interface allows it for that strip. */
3643
+ function clampHeight(height, surface) {
3644
+ const { min, max } = STRIP_HEIGHTS[surface];
3645
+ return Math.min(max, Math.max(min, Math.round(height)));
3646
+ }
3647
+ const text$1 = (params, name) => {
3648
+ const value = params[name];
3649
+ if (typeof value !== "string") throw new Error(`${name} must be text`);
3650
+ return value;
3651
+ };
3652
+ /** Answers a surface's requests: what the pack was allowed to ask in its manifest, within limits, nothing else. */
3653
+ var Bridge = class {
3654
+ env;
3655
+ stamps = [];
3656
+ spoke;
3657
+ constructor(env) {
3658
+ this.env = env;
3659
+ }
3660
+ async answer(message) {
3661
+ try {
3662
+ return {
3663
+ ok: true,
3664
+ value: await this.run(message.method, message.params)
3665
+ };
3666
+ } catch (error) {
3667
+ return {
3668
+ ok: false,
3669
+ error: error instanceof Error ? error.message : String(error)
3670
+ };
3671
+ }
3672
+ }
3673
+ allowed(action) {
3674
+ if (!this.env.actions.includes(action)) throw new Error(`the pack did not ask for "${action}" in its pack.json actions`);
3675
+ }
3676
+ words(params) {
3677
+ const words = text$1(params, "text").trim();
3678
+ if (words === "") throw new Error("there are no words");
3679
+ if (words.length > 2e3) throw new Error(`words are at most ${MAX_WORDS} characters`);
3680
+ return words;
3681
+ }
3682
+ async run(method, params) {
3683
+ const now = this.env.now();
3684
+ while (this.stamps.length > 0 && now - this.stamps[0] >= 1e3) this.stamps.shift();
3685
+ if (this.stamps.length >= 20) throw new Error("too many requests; at most 20 a second");
3686
+ this.stamps.push(now);
3687
+ const view = this.env.view();
3688
+ switch (method) {
3689
+ case "state":
3690
+ if (view === void 0) throw new Error("the story has not been read yet");
3691
+ return view;
3692
+ case "say": {
3693
+ this.allowed("say");
3694
+ const turn = view?.story.turn ?? 0;
3695
+ if (this.spoke !== void 0 && this.spoke.turn === turn && now - this.spoke.at < SAY_AGAIN_AFTER_MS) throw new Error("already said something this turn; wait for the story to answer");
3696
+ const words = this.words(params);
3697
+ this.spoke = {
3698
+ turn,
3699
+ at: now
3700
+ };
3701
+ await this.env.say(words);
3702
+ return null;
3703
+ }
3704
+ case "fill":
3705
+ this.allowed("fill");
3706
+ await this.env.fill(this.words(params));
3707
+ return null;
3708
+ case "choose": {
3709
+ this.allowed("choose");
3710
+ const index = params["index"];
3711
+ const chosen = typeof index === "number" && Number.isInteger(index) ? view?.suggestions[index] : void 0;
3712
+ if (chosen === void 0) throw new Error("there is no such suggestion");
3713
+ await this.env.fill(chosen);
3714
+ return null;
3715
+ }
3716
+ case "open": {
3717
+ this.allowed("open");
3718
+ const surface = params["surface"];
3719
+ if (surface !== "tab" && surface !== "sidebar") throw new Error("surface must be \"tab\" or \"sidebar\"");
3720
+ await this.env.open(surface);
3721
+ return null;
3722
+ }
3723
+ case "storage.get": return await this.env.storage("get", text$1(params, "key"));
3724
+ case "storage.set":
3725
+ await this.env.storage("set", text$1(params, "key"), params["value"]);
3726
+ return null;
3727
+ case "storage.remove":
3728
+ await this.env.storage("remove", text$1(params, "key"));
3729
+ return null;
3730
+ case "history": {
3731
+ const asked = params["limit"];
3732
+ const limit = typeof asked === "number" && Number.isInteger(asked) && asked >= 1 ? Math.min(asked, PACK_LIMITS.history.max) : PACK_LIMITS.history.fallback;
3733
+ return await this.env.history(limit);
3734
+ }
3735
+ case "theme": return this.env.theme();
3736
+ default: throw new Error(`there is no rp.${method}`);
3737
+ }
3738
+ }
3739
+ };
3740
+ //#endregion
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$20 = ".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$20 = "src/client/widgets/pack-frame/PackFrame.module.css";
3744
+ let tag$20 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$20) + "]");
3745
+ if (tag$20 === null) {
3746
+ tag$20 = document.createElement("style");
3747
+ tag$20.dataset.plugin = "@dsh-agentic-roleplay/core";
3748
+ tag$20.dataset.pluginCss = key$20;
3749
+ document.head.appendChild(tag$20);
3750
+ }
3751
+ tag$20.textContent = css$20;
3752
+ var PackFrame_module_css_default = {
3753
+ "message": "rp_h_sbFq_message",
3754
+ "problems": "rp_h_sbFq_problems",
3755
+ "hud": "rp_h_sbFq_hud",
3756
+ "fill": "rp_h_sbFq_fill",
3757
+ "tab": "rp_h_sbFq_tab",
3758
+ "frame": "rp_h_sbFq_frame"
3759
+ };
3760
+ //#endregion
3761
+ //#region src/client/widgets/pack-frame/theme.ts
3762
+ /** The colours of DSH a surface is given, so that it looks right in light and dark. */
3763
+ const SHARED_TOKENS = [
3764
+ "--dsw-alias-bg-base",
3765
+ "--dsw-alias-bg-layer-1",
3766
+ "--dsw-alias-bg-layer-2",
3767
+ "--dsw-alias-bg-overlay",
3768
+ "--dsw-alias-border-l1",
3769
+ "--dsw-alias-border-l2",
3770
+ "--dsw-alias-border-l3",
3771
+ "--dsw-alias-border-l4",
3772
+ "--dsw-alias-brand-primary",
3773
+ "--dsw-alias-label-primary",
3774
+ "--dsw-alias-label-secondary",
3775
+ "--dsw-alias-label-tertiary",
3776
+ "--dsw-alias-link",
3777
+ "--dsw-alias-state-business-primary",
3778
+ "--dsw-alias-state-error-primary",
3779
+ "--dsw-alias-state-idle-primary",
3780
+ "--dsw-alias-state-success-primary",
3781
+ "--dsw-alias-state-warn-primary",
3782
+ "--dsw-radius-sm"
3783
+ ];
3784
+ const DARK_ATTRIBUTE = "data-ds-dark-theme";
3785
+ /** The language of the interface: the page's own, else the browser's, else English. */
3786
+ function readLanguage(root = document.documentElement) {
3787
+ const written = root.getAttribute("lang") ?? (typeof navigator === "undefined" ? "" : navigator.language);
3788
+ return /^[a-z]{2}/i.exec(written)?.[0]?.toLowerCase() ?? "en";
3789
+ }
3790
+ /** The scheme, the language and the colours the page uses now. */
3791
+ function readTheme(body = document.body) {
3792
+ const style = getComputedStyle(body);
3793
+ const tokens = {};
3794
+ for (const name of SHARED_TOKENS) {
3795
+ const value = style.getPropertyValue(name).trim();
3796
+ if (value !== "") tokens[name] = value;
3797
+ }
3798
+ return {
3799
+ scheme: body.hasAttribute(DARK_ATTRIBUTE) ? "dark" : "light",
3800
+ language: readLanguage(),
3801
+ tokens
3802
+ };
3803
+ }
3804
+ /** Calls back when the page changes its scheme, its language or its colours. @returns stop. */
3805
+ function watchTheme(callback, body = document.body, root = document.documentElement) {
3806
+ const observer = new MutationObserver(callback);
3807
+ observer.observe(body, {
3808
+ attributes: true,
3809
+ attributeFilter: [
3810
+ DARK_ATTRIBUTE,
3811
+ "style",
3812
+ "class"
3813
+ ]
3814
+ });
3815
+ observer.observe(root, {
3816
+ attributes: true,
3817
+ attributeFilter: ["lang"]
3818
+ });
3819
+ return () => {
3820
+ observer.disconnect();
3821
+ };
3822
+ }
3823
+ //#endregion
3824
+ //#region src/client/widgets/pack-frame/PackFrame.tsx
3825
+ /**
3826
+ * A surface of a pack, in a frame that can run its scripts and nothing more: no access to this page,
3827
+ * its storage or the network. The only way out is the bridge, which answers what the pack asked for.
3828
+ */
3829
+ function PackFrame({ backend, pack, surface, view, input, onResize, fill, height, title }) {
3830
+ const frame = (0, react.useRef)(null);
3831
+ const [ready, setReady] = (0, react.useState)(false);
3832
+ const latest = (0, react.useRef)({
3833
+ view,
3834
+ input,
3835
+ actions: pack.actions
3836
+ });
3837
+ const before = (0, react.useRef)(void 0);
3838
+ latest.current = {
3839
+ view,
3840
+ input,
3841
+ actions: pack.actions
3842
+ };
3843
+ const file = pack.surfaces[surface]?.file;
3844
+ const bridge = (0, react.useMemo)(() => {
3845
+ return new Bridge({
3846
+ get actions() {
3847
+ return latest.current.actions;
3848
+ },
3849
+ view: () => latest.current.view,
3850
+ say: (text) => {
3851
+ latest.current.input.say(text);
3852
+ },
3853
+ fill: (text) => {
3854
+ latest.current.input.fill(text);
3855
+ },
3856
+ open: (surface) => {
3857
+ latest.current.input.open(surface);
3858
+ },
3859
+ history: (limit) => backend.history(limit),
3860
+ storage: (op, key, value) => backend.storage(op, key, value),
3861
+ theme: () => readTheme(),
3862
+ now: () => Date.now()
3863
+ });
3864
+ }, [backend]);
3865
+ const send = (message) => {
3866
+ frame.current?.contentWindow?.postMessage({
3867
+ rp: 1,
3868
+ ...message
3869
+ }, "*");
3870
+ };
3871
+ (0, react.useEffect)(() => {
3872
+ setReady(false);
3873
+ before.current = void 0;
3874
+ const onMessage = (event) => {
3875
+ if (event.source === null || event.source !== frame.current?.contentWindow) return;
3876
+ const message = parseFrameMessage(event.data);
3877
+ if (message === void 0) return;
3878
+ if (message.type === "hello") setReady(true);
3879
+ else if (message.type === "resize") {
3880
+ if (isStrip(surface)) onResize?.(clampHeight(message.height, surface));
3881
+ } else bridge.answer(message).then((answer) => {
3882
+ send({
3883
+ type: "response",
3884
+ id: message.id,
3885
+ ...answer.ok ? {
3886
+ ok: true,
3887
+ value: answer.value
3888
+ } : {
3889
+ ok: false,
3890
+ error: answer.error
3891
+ }
3892
+ });
3893
+ });
3894
+ };
3895
+ window.addEventListener("message", onMessage);
3896
+ return () => {
3897
+ window.removeEventListener("message", onMessage);
3898
+ };
3899
+ }, [
3900
+ bridge,
3901
+ file,
3902
+ pack.revision,
3903
+ onResize,
3904
+ surface
3905
+ ]);
3906
+ (0, react.useEffect)(() => {
3907
+ if (!ready) return void 0;
3908
+ const push = () => {
3909
+ send({
3910
+ type: "event",
3911
+ name: "theme",
3912
+ data: readTheme()
3913
+ });
3914
+ };
3915
+ push();
3916
+ return watchTheme(push);
3917
+ }, [ready]);
3918
+ (0, react.useEffect)(() => {
3919
+ if (!ready || view === void 0) return;
3920
+ send({
3921
+ type: "event",
3922
+ name: "state",
3923
+ data: view
3924
+ });
3925
+ const previous = before.current;
3926
+ if (previous !== void 0 && view.story.turn !== previous.story.turn) send({
3927
+ type: "event",
3928
+ name: "turn",
3929
+ data: { turn: view.story.turn }
3930
+ });
3931
+ if (previous !== void 0 && JSON.stringify(view.suggestions) !== JSON.stringify(previous.suggestions)) send({
3932
+ type: "event",
3933
+ name: "suggestions",
3934
+ data: view.suggestions
3935
+ });
3936
+ before.current = view;
3937
+ }, [ready, view]);
3938
+ if (file === void 0) return null;
3939
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
3940
+ ref: frame,
3941
+ className: `${PackFrame_module_css_default.frame}${fill === true ? ` ${PackFrame_module_css_default.fill}` : ""}`,
3942
+ style: fill === true ? void 0 : { height: `${height ?? pack.surfaces[surface]?.height ?? 56}px` },
3943
+ title,
3944
+ src: frameAddress(pack.frame, file, pack.revision),
3945
+ sandbox: "allow-scripts",
3946
+ referrerPolicy: "no-referrer",
3947
+ "data-rp-frame": surface
3948
+ });
3949
+ }
3950
+ //#endregion
3505
3951
  //#region src/client/world-editor/world-files-api.ts
3506
- async function read$1(response) {
3952
+ async function read$2(response) {
3507
3953
  if (!response.ok) {
3508
3954
  const body = await response.json().catch(() => void 0);
3509
3955
  const message = (Array.isArray(body?.problems) ? body.problems.join("; ") : void 0) ?? (typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
@@ -3521,30 +3967,488 @@ window.__ModuleLoader__.load({
3521
3967
  body: JSON.stringify(body)
3522
3968
  }
3523
3969
  });
3524
- const loadInfo = async (world, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("GET", signal)));
3525
- const saveInfo = async (world, edit, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("PUT", signal, edit)));
3526
- const loadPrompts = async (world, language, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/prompts?${query(world, language)}`, init("GET", signal)));
3527
- const loadPrompt = async (world, language, prompt, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("GET", signal)));
3970
+ const loadInfo = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("GET", signal)));
3971
+ const saveInfo = async (world, edit, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("PUT", signal, edit)));
3972
+ const loadPrompts = async (world, language, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/prompts?${query(world, language)}`, init("GET", signal)));
3973
+ const loadPrompt = async (world, language, prompt, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("GET", signal)));
3528
3974
  const savePrompt = async (world, language, prompt, text, signal) => {
3529
- await read$1(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("PUT", signal, { text })));
3975
+ await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("PUT", signal, { text })));
3530
3976
  };
3531
3977
  const removePrompt = async (world, language, prompt, signal) => {
3532
- await read$1(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("DELETE", signal)));
3978
+ await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("DELETE", signal)));
3533
3979
  };
3534
- const loadRoutines = async (world, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/routines?${query(world)}`, init("GET", signal)));
3535
- const saveRoutine = async (world, key, windows, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/routines/item?${query(world)}&key=${encodeURIComponent(key)}`, init("PUT", signal, { windows })));
3536
- const loadVariables = async (world, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("GET", signal)));
3537
- const saveVariables = async (world, variables, signal) => await read$1(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("PUT", signal, { variables })));
3980
+ const loadRoutines = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/routines?${query(world)}`, init("GET", signal)));
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 loadVariables = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("GET", signal)));
3983
+ const saveVariables = async (world, variables, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("PUT", signal, { variables })));
3984
+ const loadWorldPacks = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface?${query(world)}`, init("GET", signal)));
3985
+ const loadPackPreview = async (world, pack, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface/preview?${query(world)}&pack=${encodeURIComponent(pack)}`, init("GET", signal)));
3538
3986
  //#endregion
3539
- //#region src/client/world-editor/InfoPanel.tsx
3540
- const draftOf$1 = (info) => ({
3541
- name: info.name,
3542
- description: info.description,
3543
- tags: info.tags.join(", "),
3544
- rules: info.rules.join("\n"),
3545
- opening: info.opening,
3546
- authorName: info.authorName,
3547
- authorUrl: info.authorUrl,
3987
+ //#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
3988
+ const css$19 = ".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}";
3989
+ const key$19 = "src/client/world-editor/PacksPanel.module.css";
3990
+ let tag$19 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$19) + "]");
3991
+ if (tag$19 === null) {
3992
+ tag$19 = document.createElement("style");
3993
+ tag$19.dataset.plugin = "@dsh-agentic-roleplay/core";
3994
+ tag$19.dataset.pluginCss = key$19;
3995
+ document.head.appendChild(tag$19);
3996
+ }
3997
+ tag$19.textContent = css$19;
3998
+ var PacksPanel_module_css_default = {
3999
+ "note": "rp_FLaP7q_note",
4000
+ "stageTall": "rp_FLaP7q_stageTall",
4001
+ "group": "rp_FLaP7q_group",
4002
+ "stage": "rp_FLaP7q_stage",
4003
+ "log": "rp_FLaP7q_log",
4004
+ "controls": "rp_FLaP7q_controls",
4005
+ "files": "rp_FLaP7q_files"
4006
+ };
4007
+ //#endregion
4008
+ //#region src/client/world-editor/PacksPanel.tsx
4009
+ const WIDTHS = {
4010
+ narrow: 360,
4011
+ medium: 720,
4012
+ wide: 1100
4013
+ };
4014
+ const MAX_LOG = 8;
4015
+ /** A preview keeps nothing and has no turns played: what a surface asks to keep stays in memory until it is reloaded. */
4016
+ function previewBackend() {
4017
+ const kept = /* @__PURE__ */ new Map();
4018
+ return {
4019
+ history: () => Promise.resolve([]),
4020
+ storage: (op, key, value) => {
4021
+ if (op === "set") kept.set(key, value);
4022
+ else if (op === "remove") kept.delete(key);
4023
+ return Promise.resolve(op === "get" ? kept.get(key) ?? null : null);
4024
+ }
4025
+ };
4026
+ }
4027
+ /** The interface packs of a world: what each holds, what is wrong with it, and its surfaces shown as a story of the world would start with them. */
4028
+ function PacksPanel({ t, worldId, actions }) {
4029
+ const say = (0, react.useCallback)((key, values) => t(`pk_${key}`, values), [t]);
4030
+ const [packs, setPacks] = (0, react.useState)();
4031
+ const [chosen, setChosen] = (0, react.useState)();
4032
+ const [surface, setSurface] = (0, react.useState)();
4033
+ const [width, setWidth] = (0, react.useState)("medium");
4034
+ const [reload, setReload] = (0, react.useState)(0);
4035
+ const [preview, setPreview] = (0, react.useState)();
4036
+ const [log, setLog] = (0, react.useState)([]);
4037
+ (0, react.useEffect)(() => {
4038
+ const abort = new AbortController();
4039
+ loadWorldPacks(worldId, abort.signal).then(setPacks, (failure) => {
4040
+ if (!abort.signal.aborted) setPacks({ failed: failure instanceof Error ? failure.message : String(failure) });
4041
+ });
4042
+ return () => {
4043
+ abort.abort();
4044
+ };
4045
+ }, [worldId, reload]);
4046
+ const list = Array.isArray(packs) ? packs : [];
4047
+ const pack = list.find((entry) => entry.id === chosen) ?? list[0];
4048
+ const surfaces = pack === void 0 ? [] : SURFACE_NAMES.filter((name) => pack.surfaces[name] !== void 0);
4049
+ const shown = surface !== void 0 && surfaces.includes(surface) ? surface : surfaces[0];
4050
+ (0, react.useEffect)(() => {
4051
+ setPreview(void 0);
4052
+ setLog([]);
4053
+ if (pack === void 0 || pack.problems.length > 0) return void 0;
4054
+ const abort = new AbortController();
4055
+ loadPackPreview(worldId, pack.id, abort.signal).then(setPreview, (failure) => {
4056
+ if (!abort.signal.aborted) setPreview({ failed: failure instanceof Error ? failure.message : String(failure) });
4057
+ });
4058
+ return () => {
4059
+ abort.abort();
4060
+ };
4061
+ }, [
4062
+ worldId,
4063
+ pack?.id,
4064
+ pack?.problems.length,
4065
+ reload
4066
+ ]);
4067
+ const backend = (0, react.useMemo)(previewBackend, [preview, reload]);
4068
+ const note = (0, react.useCallback)((entry) => {
4069
+ setLog((before) => [entry, ...before].slice(0, MAX_LOG));
4070
+ }, []);
4071
+ const input = (0, react.useMemo)(() => ({
4072
+ say: (text) => {
4073
+ note(say("logSay", { text }));
4074
+ },
4075
+ fill: (text) => {
4076
+ note(say("logFill", { text }));
4077
+ },
4078
+ open: (target) => {
4079
+ note(say("logOpen", { surface: say(target) }));
4080
+ }
4081
+ }), [note, say]);
4082
+ const [stripHeight, setStripHeight] = (0, react.useState)();
4083
+ (0, react.useEffect)(() => {
4084
+ setStripHeight(void 0);
4085
+ }, [
4086
+ shown,
4087
+ preview,
4088
+ reload
4089
+ ]);
4090
+ const refresh = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4091
+ variant: "ghost",
4092
+ size: "sm",
4093
+ onClick: () => {
4094
+ setReload((count) => count + 1);
4095
+ },
4096
+ children: say("reload")
4097
+ });
4098
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4099
+ className: CharactersPanel_module_css_default.panel,
4100
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4101
+ className: CharactersPanel_module_css_default.tabs,
4102
+ role: "tablist",
4103
+ children: [
4104
+ list.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4105
+ type: "button",
4106
+ role: "tab",
4107
+ "aria-selected": entry.id === pack?.id,
4108
+ className: `${CharactersPanel_module_css_default.tab} ${entry.id === pack?.id ? CharactersPanel_module_css_default.tabOn : ""}`,
4109
+ onClick: () => {
4110
+ setChosen(entry.id);
4111
+ },
4112
+ children: entry.name
4113
+ }, entry.id)),
4114
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }),
4115
+ actions
4116
+ ]
4117
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4118
+ className: CharactersPanel_module_css_default.body,
4119
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
4120
+ className: CharactersPanel_module_css_default.sheet,
4121
+ children: [
4122
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: say("help") }),
4123
+ packs === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: say("loading") }),
4124
+ packs !== void 0 && !Array.isArray(packs) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4125
+ className: CharactersPanel_module_css_default.error,
4126
+ role: "alert",
4127
+ children: say("loadFailed", { message: packs.failed })
4128
+ }),
4129
+ Array.isArray(packs) && list.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: say("none") }),
4130
+ pack !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4131
+ className: CharactersPanel_module_css_default.section,
4132
+ children: [
4133
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
4134
+ className: CharactersPanel_module_css_default.sectionTitle,
4135
+ children: [
4136
+ pack.name,
4137
+ " ",
4138
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: pack.id }),
4139
+ pack.version !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [" ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: say("version", { version: pack.version }) })] })
4140
+ ]
4141
+ }),
4142
+ pack.description !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: pack.description }),
4143
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
4144
+ pack.actions.length === 0 ? say("noActions") : `${say("actions")}: ${pack.actions.join(", ")}`,
4145
+ pack.skin === void 0 ? "" : ` · ${say("skin", { file: pack.skin })}`,
4146
+ pack.tokens === 0 ? "" : ` · ${say("tokens", { count: pack.tokens })}`
4147
+ ] }),
4148
+ surfaces.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
4149
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4150
+ className: CharactersPanel_module_css_default.label,
4151
+ children: say("surfaces")
4152
+ }),
4153
+ " ",
4154
+ surfaces.map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: [
4155
+ say(name),
4156
+ ": ",
4157
+ pack.surfaces[name]?.file
4158
+ ] }, name))
4159
+ ] }),
4160
+ pack.files.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", { children: [
4161
+ say("files"),
4162
+ " (",
4163
+ pack.files.length,
4164
+ ")"
4165
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
4166
+ className: PacksPanel_module_css_default.files,
4167
+ children: pack.files.map((file) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [
4168
+ file.path,
4169
+ " ",
4170
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4171
+ className: CharactersPanel_module_css_default.label,
4172
+ children: [file.size, " B"]
4173
+ })
4174
+ ] }, file.path))
4175
+ })] }),
4176
+ pack.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4177
+ className: CharactersPanel_module_css_default.error,
4178
+ role: "alert",
4179
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: say("problems") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: pack.problems.map((problem, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: problem.file === "" ? problem.message : `${problem.file}: ${problem.message}` }, index)) })]
4180
+ })
4181
+ ]
4182
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4183
+ className: CharactersPanel_module_css_default.section,
4184
+ children: [
4185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
4186
+ className: CharactersPanel_module_css_default.sectionTitle,
4187
+ children: say("preview")
4188
+ }),
4189
+ pack.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: say("previewBlocked") }),
4190
+ pack.problems.length === 0 && surfaces.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: say("noSurfaces") }),
4191
+ preview !== void 0 && "failed" in preview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4192
+ className: CharactersPanel_module_css_default.error,
4193
+ role: "alert",
4194
+ children: say("previewFailed", { message: preview.failed })
4195
+ }),
4196
+ preview !== void 0 && !("failed" in preview) && shown !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4197
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4198
+ className: PacksPanel_module_css_default.controls,
4199
+ children: [
4200
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4201
+ className: PacksPanel_module_css_default.group,
4202
+ children: [
4203
+ say("surface"),
4204
+ " ",
4205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
4206
+ value: shown,
4207
+ onChange: (event) => {
4208
+ setSurface(event.target.value);
4209
+ },
4210
+ children: surfaces.map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4211
+ value: name,
4212
+ children: say(name)
4213
+ }, name))
4214
+ })
4215
+ ]
4216
+ }),
4217
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4218
+ className: PacksPanel_module_css_default.group,
4219
+ children: [
4220
+ say("width"),
4221
+ " ",
4222
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
4223
+ value: width,
4224
+ onChange: (event) => {
4225
+ setWidth(event.target.value);
4226
+ },
4227
+ children: Object.keys(WIDTHS).map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
4228
+ value: name,
4229
+ children: [
4230
+ say(name),
4231
+ " (",
4232
+ WIDTHS[name],
4233
+ ")"
4234
+ ]
4235
+ }, name))
4236
+ })
4237
+ ]
4238
+ }),
4239
+ refresh
4240
+ ]
4241
+ }),
4242
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4243
+ className: `${PacksPanel_module_css_default.stage}${isStrip(shown) ? "" : ` ${PacksPanel_module_css_default.stageTall}`}`,
4244
+ style: { width: `${WIDTHS[width]}px` },
4245
+ "data-testid": "roleplay-pack-preview",
4246
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
4247
+ backend,
4248
+ pack: preview.pack,
4249
+ surface: shown,
4250
+ view: preview.view,
4251
+ input,
4252
+ onResize: setStripHeight,
4253
+ title: `${pack.name}: ${say(shown)}`,
4254
+ ...isStrip(shown) ? stripHeight === void 0 ? {} : { height: stripHeight } : { fill: true }
4255
+ }, `${preview.pack.revision}-${shown}-${reload}`)
4256
+ }),
4257
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4258
+ className: PacksPanel_module_css_default.note,
4259
+ children: say("previewNote")
4260
+ }),
4261
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4262
+ className: CharactersPanel_module_css_default.label,
4263
+ children: say("log")
4264
+ }), log.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4265
+ className: PacksPanel_module_css_default.note,
4266
+ children: say("logEmpty")
4267
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
4268
+ className: PacksPanel_module_css_default.log,
4269
+ children: log.map((entry, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: entry }, `${index}-${entry}`))
4270
+ })] })
4271
+ ] })
4272
+ ]
4273
+ })] })
4274
+ ]
4275
+ })
4276
+ })]
4277
+ });
4278
+ }
4279
+ //#endregion
4280
+ //#region src/client/world-editor/trigger-text.ts
4281
+ function namesOf(world) {
4282
+ const by = (list) => {
4283
+ const names = new Map((list ?? []).map((entry) => [entry.key, entry.name]));
4284
+ return (key) => key === "@self" ? key : names.get(key) ?? key;
4285
+ };
4286
+ return {
4287
+ character: by(world.characters),
4288
+ place: by(world.places),
4289
+ item: by(world.things),
4290
+ trigger: by(world.triggers)
4291
+ };
4292
+ }
4293
+ const OPS = {
4294
+ eq: "opEq",
4295
+ ne: "opNe",
4296
+ lt: "opLt",
4297
+ le: "opLe",
4298
+ gt: "opGt",
4299
+ ge: "opGe"
4300
+ };
4301
+ /** A condition in a sentence. */
4302
+ function describeCondition(say, names, condition) {
4303
+ switch (condition.type) {
4304
+ case "time": return [
4305
+ ...condition.from === void 0 ? [] : [say("timeFrom", { at: condition.from.replace("T", " ") })],
4306
+ ...condition.to === void 0 ? [] : [say("timeTo", { at: condition.to.replace("T", " ") })],
4307
+ ...condition.window === void 0 ? [] : [say("timeWindow", {
4308
+ from: condition.window.from,
4309
+ to: condition.window.to
4310
+ })],
4311
+ ...condition.days === void 0 || condition.days.length === 0 ? [] : [say("timeDays", { days: condition.days.join(", ") })]
4312
+ ].join(", ");
4313
+ case "place": return condition.feature === void 0 ? say("place", {
4314
+ who: names.character(condition.character),
4315
+ where: names.place(condition.location)
4316
+ }) : say("placeAt", {
4317
+ who: names.character(condition.character),
4318
+ where: names.place(condition.location),
4319
+ feature: condition.feature
4320
+ });
4321
+ case "variable": return condition.subject === void 0 ? say("variable", {
4322
+ name: condition.variable,
4323
+ op: say(OPS[condition.op]),
4324
+ value: String(condition.value)
4325
+ }) : say("variableOf", {
4326
+ name: condition.variable,
4327
+ subject: names.character(condition.subject),
4328
+ op: say(OPS[condition.op]),
4329
+ value: String(condition.value)
4330
+ });
4331
+ case "item": return condition.heldBy !== void 0 ? say("heldBy", {
4332
+ item: names.item(condition.item),
4333
+ who: names.character(condition.heldBy)
4334
+ }) : say("lyingIn", {
4335
+ item: names.item(condition.item),
4336
+ where: names.place(condition.at ?? "")
4337
+ });
4338
+ case "event": return say("event", { tag: condition.tag });
4339
+ case "fired": return say("firedTrigger", { trigger: names.trigger(condition.trigger) });
4340
+ case "judged": return say("judged", { text: condition.text });
4341
+ case "all": return say("all", { parts: condition.conditions.map((part) => describeCondition(say, names, part)).join("; ") });
4342
+ case "any": return say("any", { parts: condition.conditions.map((part) => describeCondition(say, names, part)).join("; ") });
4343
+ case "not": return say("not", { part: describeCondition(say, names, condition.condition) });
4344
+ }
4345
+ }
4346
+ function describeAudience(say, names, audience) {
4347
+ if (audience === "everyone") return say("everyone");
4348
+ if ("place" in audience) return say("whoeverIn", { where: names.place(audience.place) });
4349
+ return audience.characters.map(names.character).join(", ");
4350
+ }
4351
+ /** An effect in a sentence, with what a beat or cue waits on. */
4352
+ function describeEffect(say, names, effect) {
4353
+ if (effect.type === "edit") return say("edit", { events: Array.isArray(effect.edit["events"]) ? effect.edit["events"].length : 0 });
4354
+ const text = effect.type === "beat" ? say("beat", { text: effect.text }) : say("cue", {
4355
+ audience: describeAudience(say, names, effect.audience),
4356
+ text: effect.text
4357
+ });
4358
+ return effect.while === void 0 ? text : `${text} (${say("only", { condition: describeCondition(say, names, effect.while) })})`;
4359
+ }
4360
+ //#endregion
4361
+ //#region src/client/world-editor/TriggersPanel.tsx
4362
+ const STATUS = {
4363
+ fired: "fired",
4364
+ failed: "failed",
4365
+ expired: "expired",
4366
+ dormant: "dormant"
4367
+ };
4368
+ /** What the world does by itself, in sentences: what each trigger waits for and does, and what is wrong with it. It is read-only; the files and the world author make them. */
4369
+ function TriggersPanel({ t, world, actions }) {
4370
+ const say = (key, values) => t(`trig_${key}`, values);
4371
+ const names = namesOf(world);
4372
+ const story = world.triggers?.some((trigger) => trigger.status !== void 0) === true;
4373
+ const triggers = world.triggers ?? [];
4374
+ const meta = (trigger) => [
4375
+ ...trigger.repeat ? [say("repeats")] : [],
4376
+ ...trigger.cooldownSeconds === void 0 ? [] : [say("cooldown", { time: `${Math.round(trigger.cooldownSeconds / 60)} min` })],
4377
+ ...trigger.chance === void 0 ? [] : [say("chance", { percent: Math.round(trigger.chance * 100) })],
4378
+ ...trigger.priority === 0 ? [] : [say("priority", { value: trigger.priority })],
4379
+ ...trigger.expires === void 0 ? [] : [say("expires", { at: trigger.expires.replace("T", " ") })],
4380
+ ...trigger.announced ? [say("announced")] : []
4381
+ ];
4382
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4383
+ className: CharactersPanel_module_css_default.panel,
4384
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4385
+ className: CharactersPanel_module_css_default.tabs,
4386
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }), actions]
4387
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4388
+ className: CharactersPanel_module_css_default.body,
4389
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
4390
+ className: CharactersPanel_module_css_default.sheet,
4391
+ children: [
4392
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: story ? t("trig_helpStory") : t("trig_help") }),
4393
+ world.triggersProblem !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4394
+ className: CharactersPanel_module_css_default.error,
4395
+ role: "alert",
4396
+ children: t("trig_fileProblem", { message: world.triggersProblem })
4397
+ }),
4398
+ world.triggersProblem === void 0 && triggers.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("trig_none") }),
4399
+ triggers.map((trigger) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4400
+ className: CharactersPanel_module_css_default.section,
4401
+ "data-testid": `roleplay-trigger-${trigger.key}`,
4402
+ children: [
4403
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
4404
+ className: CharactersPanel_module_css_default.sectionTitle,
4405
+ children: [
4406
+ trigger.name,
4407
+ " ",
4408
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: trigger.key }),
4409
+ trigger.status !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4410
+ " ",
4411
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: say(STATUS[trigger.status]) }),
4412
+ trigger.fireCount !== void 0 && trigger.fireCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [" ", say("firedCount", { count: trigger.fireCount })] })
4413
+ ] }),
4414
+ trigger.origin === "story" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [" ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: say("fromStory") })] })
4415
+ ]
4416
+ }),
4417
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
4418
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4419
+ className: CharactersPanel_module_css_default.label,
4420
+ children: say("when")
4421
+ }),
4422
+ " ",
4423
+ describeCondition(say, names, trigger.when)
4424
+ ] }),
4425
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4426
+ className: CharactersPanel_module_css_default.label,
4427
+ children: say("then")
4428
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: trigger.effects.map((effect, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: describeEffect(say, names, effect) }, index)) })] }),
4429
+ meta(trigger).length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: meta(trigger).join(" · ") }),
4430
+ trigger.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4431
+ className: CharactersPanel_module_css_default.error,
4432
+ role: "alert",
4433
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: say("problems") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: trigger.problems.map((problem) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: problem }, problem)) })]
4434
+ })
4435
+ ]
4436
+ }, trigger.key))
4437
+ ]
4438
+ })
4439
+ })]
4440
+ });
4441
+ }
4442
+ //#endregion
4443
+ //#region src/client/world-editor/InfoPanel.tsx
4444
+ const draftOf$1 = (info) => ({
4445
+ name: info.name,
4446
+ description: info.description,
4447
+ tags: info.tags.join(", "),
4448
+ rules: info.rules.join("\n"),
4449
+ opening: info.opening,
4450
+ authorName: info.authorName,
4451
+ authorUrl: info.authorUrl,
3548
4452
  timeZone: info.timeZone,
3549
4453
  startingTime: info.startingTime,
3550
4454
  version: info.version,
@@ -4083,11 +4987,14 @@ window.__ModuleLoader__.load({
4083
4987
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4084
4988
  className: CharactersPanel_module_css_default.tabs,
4085
4989
  role: "tablist",
4990
+ "aria-label": t("characters"),
4991
+ onKeyDown: navigateEditorTabs,
4086
4992
  children: [
4087
4993
  world.characters.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4088
4994
  type: "button",
4089
4995
  role: "tab",
4090
4996
  "aria-selected": entry.key === character.key,
4997
+ tabIndex: entry.key === character.key ? 0 : -1,
4091
4998
  className: `${CharactersPanel_module_css_default.tab} ${entry.key === character.key ? CharactersPanel_module_css_default.tabOn : ""}`,
4092
4999
  onClick: () => {
4093
5000
  setChosen(entry.key);
@@ -4686,7 +5593,9 @@ window.__ModuleLoader__.load({
4686
5593
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
4687
5594
  className,
4688
5595
  src,
4689
- alt
5596
+ alt,
5597
+ loading: "lazy",
5598
+ decoding: "async"
4690
5599
  })
4691
5600
  })
4692
5601
  }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ImageLightbox, {
@@ -4745,51 +5654,51 @@ window.__ModuleLoader__.load({
4745
5654
  const imageUrl = (target, image) => `${route(target, "/file")}&path=${encodeURIComponent(image.path)}&v=${encodeURIComponent(image.createdAt)}`;
4746
5655
  //#endregion
4747
5656
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/gallery-view/GalleryView.module.css.mjs
4748
- const css$17 = ".rp_9pSHmG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;padding:16px 24px;display:flex;overflow-y:auto}.rp_9pSHmG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;display:flex}.rp_9pSHmG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_actions{align-items:center;gap:8px;display:flex}.rp_9pSHmG_select{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);height:28px;font:inherit;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);padding:0 8px;font-size:12px}.rp_9pSHmG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 24px;font-size:13px}.rp_9pSHmG_grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_9pSHmG_cell{min-width:0}.rp_9pSHmG_thumb{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);width:100%;font:inherit;text-align:left;color:inherit;cursor:pointer;flex-direction:column;padding:0;display:flex;overflow:hidden}.rp_9pSHmG_open{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.rp_9pSHmG_thumb:hover{border-color:var(--dsw-alias-border-l4)}.rp_9pSHmG_image{aspect-ratio:1;object-fit:cover;background:var(--dsw-alias-bg-layer-3);width:100%;display:block}.rp_9pSHmG_caption{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);padding:6px 8px;font-size:12px;overflow:hidden}.rp_9pSHmG_detail{flex-direction:column;gap:12px;width:min(640px,100%);max-height:70vh;display:flex;overflow-y:auto}.rp_9pSHmG_large{border-radius:var(--dsw-radius-sm);object-fit:contain;max-width:100%;max-height:32vh;margin:0 auto;display:block}.rp_9pSHmG_facts{grid-template-columns:max-content 1fr;gap:6px 12px;margin:0;font-size:12px;line-height:18px;display:grid}.rp_9pSHmG_facts dt{color:var(--dsw-alias-label-tertiary)}.rp_9pSHmG_facts dd{min-width:0;color:var(--dsw-alias-label-primary);margin:0}.rp_9pSHmG_pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:160px;overflow-y:auto}.rp_9pSHmG_tags{flex-wrap:wrap;gap:4px;display:flex}.rp_9pSHmG_note{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_9pSHmG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_9pSHmG_status,.rp_9pSHmG_statusError{color:var(--dsw-alias-label-tertiary);padding:0 8px 6px;font-size:11px;line-height:16px}.rp_9pSHmG_statusError{color:var(--dsw-alias-state-error-primary)}.rp_9pSHmG_reusable{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:6px;padding:0 8px 6px;font-size:11px;display:flex}.rp_9pSHmG_reusable input{accent-color:var(--dsw-alias-state-business-primary);margin:0}.rp_9pSHmG_editButton{font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;border:0;align-self:flex-start;margin:0 8px 4px;padding:0;font-size:11px}.rp_9pSHmG_edit{flex-direction:column;gap:12px;width:min(480px,100%);display:flex}.rp_9pSHmG_editField{flex-direction:column;gap:4px;display:flex}.rp_9pSHmG_editLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_9pSHmG_editHelp{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_editArea,.rp_9pSHmG_editInput{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);font:inherit;color:var(--dsw-alias-label-primary);padding:6px 8px;font-size:13px}.rp_9pSHmG_editArea{resize:vertical}";
4749
- const key$17 = "src/client/widgets/gallery-view/GalleryView.module.css";
4750
- let tag$17 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$17) + "]");
4751
- if (tag$17 === null) {
4752
- tag$17 = document.createElement("style");
4753
- tag$17.dataset.plugin = "@dsh-agentic-roleplay/core";
4754
- tag$17.dataset.pluginCss = key$17;
4755
- document.head.appendChild(tag$17);
5657
+ const css$18 = ".rp_9pSHmG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;padding:16px 24px;display:flex;overflow-y:auto}.rp_9pSHmG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;display:flex}.rp_9pSHmG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_9pSHmG_select{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);height:32px;font:inherit;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);padding:0 8px;font-size:12px}.rp_9pSHmG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 24px;font-size:13px}.rp_9pSHmG_grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_9pSHmG_cell{min-width:0}.rp_9pSHmG_thumb{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);width:100%;font:inherit;text-align:left;color:inherit;cursor:pointer;flex-direction:column;padding:0;display:flex;overflow:hidden}.rp_9pSHmG_open{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.rp_9pSHmG_thumb:hover{border-color:var(--dsw-alias-border-l4)}.rp_9pSHmG_image{aspect-ratio:1;object-fit:cover;background:var(--dsw-alias-bg-layer-3);width:100%;display:block}.rp_9pSHmG_caption{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);padding:6px 8px;font-size:12px;overflow:hidden}.rp_9pSHmG_detail{flex-direction:column;gap:12px;width:min(640px,100%);max-height:70vh;display:flex;overflow-y:auto}.rp_9pSHmG_large{border-radius:var(--dsw-radius-lg);object-fit:contain;max-width:100%;max-height:32vh;margin:0 auto;display:block}.rp_9pSHmG_facts{grid-template-columns:max-content 1fr;gap:6px 12px;margin:0;font-size:12px;line-height:18px;display:grid}.rp_9pSHmG_facts dt{color:var(--dsw-alias-label-tertiary)}.rp_9pSHmG_facts dd{min-width:0;color:var(--dsw-alias-label-primary);margin:0}.rp_9pSHmG_pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:160px;overflow-y:auto}.rp_9pSHmG_tags{flex-wrap:wrap;gap:4px;display:flex}.rp_9pSHmG_note{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_9pSHmG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_9pSHmG_status,.rp_9pSHmG_statusError{color:var(--dsw-alias-label-tertiary);padding:0 8px 6px;font-size:11px;line-height:16px}.rp_9pSHmG_statusError{color:var(--dsw-alias-state-error-primary)}.rp_9pSHmG_reusable{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:6px;padding:0 8px 6px;font-size:11px;display:flex}.rp_9pSHmG_reusable input{accent-color:var(--dsw-alias-state-business-primary);margin:0}.rp_9pSHmG_editButton{font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;border:0;align-self:flex-start;margin:0 8px 4px;padding:0;font-size:11px}.rp_9pSHmG_edit{flex-direction:column;gap:12px;width:min(480px,100%);display:flex}.rp_9pSHmG_editField{flex-direction:column;gap:4px;display:flex}.rp_9pSHmG_editLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_9pSHmG_editHelp{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_editArea,.rp_9pSHmG_editInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);font:inherit;color:var(--dsw-alias-label-primary);padding:6px 8px;font-size:13px}.rp_9pSHmG_editArea{resize:vertical;min-height:96px}.rp_9pSHmG_editArea:focus-visible,.rp_9pSHmG_editInput:focus-visible,.rp_9pSHmG_select:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}@media (width<=640px){.rp_9pSHmG_page{padding-inline:16px}.rp_9pSHmG_toolbar{align-items:flex-start}.rp_9pSHmG_grid{grid-template-columns:repeat(auto-fill,minmax(136px,1fr))}}";
5658
+ const key$18 = "src/client/widgets/gallery-view/GalleryView.module.css";
5659
+ let tag$18 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$18) + "]");
5660
+ if (tag$18 === null) {
5661
+ tag$18 = document.createElement("style");
5662
+ tag$18.dataset.plugin = "@dsh-agentic-roleplay/core";
5663
+ tag$18.dataset.pluginCss = key$18;
5664
+ document.head.appendChild(tag$18);
4756
5665
  }
4757
- tag$17.textContent = css$17;
5666
+ tag$18.textContent = css$18;
4758
5667
  var GalleryView_module_css_default = {
4759
- "reusable": "rp_9pSHmG_reusable",
5668
+ "caption": "rp_9pSHmG_caption",
5669
+ "thumb": "rp_9pSHmG_thumb",
5670
+ "message": "rp_9pSHmG_message",
4760
5671
  "editField": "rp_9pSHmG_editField",
4761
5672
  "facts": "rp_9pSHmG_facts",
4762
- "caption": "rp_9pSHmG_caption",
5673
+ "editArea": "rp_9pSHmG_editArea",
5674
+ "editInput": "rp_9pSHmG_editInput",
4763
5675
  "editHelp": "rp_9pSHmG_editHelp",
4764
- "grid": "rp_9pSHmG_grid",
4765
- "detail": "rp_9pSHmG_detail",
4766
- "error": "rp_9pSHmG_error",
5676
+ "status": "rp_9pSHmG_status",
5677
+ "reusable": "rp_9pSHmG_reusable",
5678
+ "editButton": "rp_9pSHmG_editButton",
4767
5679
  "page": "rp_9pSHmG_page",
4768
- "cell": "rp_9pSHmG_cell",
4769
- "select": "rp_9pSHmG_select",
4770
5680
  "pre": "rp_9pSHmG_pre",
4771
- "editInput": "rp_9pSHmG_editInput",
5681
+ "actions": "rp_9pSHmG_actions",
5682
+ "error": "rp_9pSHmG_error",
5683
+ "toolbar": "rp_9pSHmG_toolbar",
5684
+ "open": "rp_9pSHmG_open",
5685
+ "tags": "rp_9pSHmG_tags",
4772
5686
  "note": "rp_9pSHmG_note",
5687
+ "large": "rp_9pSHmG_large",
4773
5688
  "count": "rp_9pSHmG_count",
4774
- "status": "rp_9pSHmG_status",
4775
- "actions": "rp_9pSHmG_actions",
4776
- "editLabel": "rp_9pSHmG_editLabel",
4777
- "editArea": "rp_9pSHmG_editArea",
4778
- "thumb": "rp_9pSHmG_thumb",
5689
+ "image": "rp_9pSHmG_image",
5690
+ "select": "rp_9pSHmG_select",
4779
5691
  "edit": "rp_9pSHmG_edit",
4780
- "editButton": "rp_9pSHmG_editButton",
4781
- "open": "rp_9pSHmG_open",
4782
- "message": "rp_9pSHmG_message",
4783
5692
  "statusError": "rp_9pSHmG_statusError",
4784
- "image": "rp_9pSHmG_image",
4785
- "toolbar": "rp_9pSHmG_toolbar",
4786
- "large": "rp_9pSHmG_large",
4787
- "tags": "rp_9pSHmG_tags"
5693
+ "editLabel": "rp_9pSHmG_editLabel",
5694
+ "grid": "rp_9pSHmG_grid",
5695
+ "detail": "rp_9pSHmG_detail",
5696
+ "cell": "rp_9pSHmG_cell"
4788
5697
  };
4789
5698
  //#endregion
4790
5699
  //#region src/client/widgets/gallery-view/GalleryView.tsx
4791
5700
  /** How often the list is read again while pictures are waiting to be described. */
4792
- const POLL_MS$1 = 3e3;
5701
+ const POLL_MS$2 = 3e3;
4793
5702
  const messageOf$1 = (error) => error instanceof Error ? error.message : String(error);
4794
5703
  function EditDialog({ t, image, onSave, onClose }) {
4795
5704
  const [description, setDescription] = (0, react.useState)(image.description ?? "");
@@ -4910,7 +5819,7 @@ window.__ModuleLoader__.load({
4910
5819
  const abort = new AbortController();
4911
5820
  const timer = window.setTimeout(() => {
4912
5821
  read(abort.signal);
4913
- }, POLL_MS$1);
5822
+ }, POLL_MS$2);
4914
5823
  return () => {
4915
5824
  window.clearTimeout(timer);
4916
5825
  abort.abort();
@@ -5114,24 +6023,24 @@ window.__ModuleLoader__.load({
5114
6023
  }
5115
6024
  //#endregion
5116
6025
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/WorldEditor.module.css.mjs
5117
- const css$16 = ".rp__swA3a_view{flex:1 1 0;width:100%;min-height:0;display:flex}.rp__swA3a_message{color:var(--dsw-alias-label-secondary);margin:0;padding:24px;font-size:13px}.rp__swA3a_warning{color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);margin:0 0 12px;padding:8px 12px;font-size:13px}.rp__swA3a_drawer{box-sizing:border-box;border-right:1px solid var(--dsw-alias-border-l3);flex-direction:column;flex:0 0 168px;gap:2px;padding:16px 8px;display:flex}.rp__swA3a_drawerItem{border-radius:var(--dsw-radius-sm);width:100%;font:inherit;text-align:left;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:6px 12px;font-size:13px;line-height:20px;display:block}.rp__swA3a_drawerItem:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.rp__swA3a_drawerItemOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2);font-weight:500}.rp__swA3a_content{flex-direction:column;flex:1 1 0;min-width:0;min-height:0;display:flex}";
5118
- const key$16 = "src/client/world-editor/WorldEditor.module.css";
5119
- let tag$16 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$16) + "]");
5120
- if (tag$16 === null) {
5121
- tag$16 = document.createElement("style");
5122
- tag$16.dataset.plugin = "@dsh-agentic-roleplay/core";
5123
- tag$16.dataset.pluginCss = key$16;
5124
- document.head.appendChild(tag$16);
6026
+ const css$17 = ".rp__swA3a_view{flex:1 1 0;width:100%;min-height:0;display:flex}.rp__swA3a_message{color:var(--dsw-alias-label-secondary);margin:0;padding:24px;font-size:13px}.rp__swA3a_warning{color:var(--dsw-alias-label-primary);border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-2);margin:0 0 12px;padding:8px 12px;font-size:13px}.rp__swA3a_drawer{box-sizing:border-box;border-right:.5px solid var(--dsw-alias-border-l3);flex-direction:column;flex:0 0 168px;gap:2px;padding:16px 8px;display:flex}.rp__swA3a_drawerItem{border-radius:var(--dsw-radius-md);width:100%;font:inherit;text-align:left;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:6px 12px;font-size:13px;line-height:20px;display:block}@media (width<=720px){.rp__swA3a_view{flex-direction:column}.rp__swA3a_drawer{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l3);flex-direction:row;flex:none;width:100%;padding:8px;overflow-x:auto}.rp__swA3a_drawerItem{white-space:nowrap;flex:none;width:auto}}.rp__swA3a_drawerItem:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.rp__swA3a_drawerItemOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2);font-weight:500}.rp__swA3a_content{flex-direction:column;flex:1 1 0;min-width:0;min-height:0;display:flex}";
6027
+ const key$17 = "src/client/world-editor/WorldEditor.module.css";
6028
+ let tag$17 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$17) + "]");
6029
+ if (tag$17 === null) {
6030
+ tag$17 = document.createElement("style");
6031
+ tag$17.dataset.plugin = "@dsh-agentic-roleplay/core";
6032
+ tag$17.dataset.pluginCss = key$17;
6033
+ document.head.appendChild(tag$17);
5125
6034
  }
5126
- tag$16.textContent = css$16;
6035
+ tag$17.textContent = css$17;
5127
6036
  var WorldEditor_module_css_default = {
5128
- "drawer": "rp__swA3a_drawer",
5129
6037
  "view": "rp__swA3a_view",
5130
- "content": "rp__swA3a_content",
6038
+ "drawer": "rp__swA3a_drawer",
6039
+ "drawerItemOn": "rp__swA3a_drawerItemOn",
5131
6040
  "drawerItem": "rp__swA3a_drawerItem",
6041
+ "content": "rp__swA3a_content",
5132
6042
  "warning": "rp__swA3a_warning",
5133
- "message": "rp__swA3a_message",
5134
- "drawerItemOn": "rp__swA3a_drawerItemOn"
6043
+ "message": "rp__swA3a_message"
5135
6044
  };
5136
6045
  //#endregion
5137
6046
  //#region src/client/world-editor/WorldEditor.tsx
@@ -5172,6 +6081,11 @@ window.__ModuleLoader__.load({
5172
6081
  label: "plots",
5173
6082
  built: true
5174
6083
  },
6084
+ {
6085
+ id: "triggers",
6086
+ label: "trig_title",
6087
+ built: true
6088
+ },
5175
6089
  {
5176
6090
  id: "relations",
5177
6091
  label: "relationships",
@@ -5195,6 +6109,12 @@ window.__ModuleLoader__.load({
5195
6109
  built: true,
5196
6110
  ownFiles: true
5197
6111
  },
6112
+ {
6113
+ id: "interface",
6114
+ label: "pk_title",
6115
+ built: true,
6116
+ ownFiles: true
6117
+ },
5198
6118
  {
5199
6119
  id: "images",
5200
6120
  label: "sectionImages",
@@ -5255,6 +6175,7 @@ window.__ModuleLoader__.load({
5255
6175
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5256
6176
  className: WorldEditor_module_css_default.view,
5257
6177
  "data-testid": "roleplay-world",
6178
+ onKeyDownCapture: navigateEditorTabs,
5258
6179
  children: [sections.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
5259
6180
  className: WorldEditor_module_css_default.drawer,
5260
6181
  "aria-label": t("sections"),
@@ -5324,6 +6245,17 @@ window.__ModuleLoader__.load({
5324
6245
  children: t("editorRefresh")
5325
6246
  })
5326
6247
  }),
6248
+ section === "interface" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PacksPanel, {
6249
+ t,
6250
+ worldId: source.worldId,
6251
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6252
+ variant: "ghost",
6253
+ size: "sm",
6254
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
6255
+ onClick: refresh,
6256
+ children: t("editorRefresh")
6257
+ })
6258
+ }),
5327
6259
  section === "images" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GalleryView, {
5328
6260
  t: galleryText,
5329
6261
  target: {
@@ -5410,10 +6342,21 @@ window.__ModuleLoader__.load({
5410
6342
  children: t("editorRefresh")
5411
6343
  })
5412
6344
  }),
5413
- section === "relations" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RelationsPanel, {
6345
+ section === "triggers" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriggersPanel, {
5414
6346
  t,
5415
6347
  world: load.world,
5416
- source,
6348
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6349
+ variant: "ghost",
6350
+ size: "sm",
6351
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
6352
+ onClick: refresh,
6353
+ children: t("editorRefresh")
6354
+ })
6355
+ }),
6356
+ section === "relations" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RelationsPanel, {
6357
+ t,
6358
+ world: load.world,
6359
+ source,
5417
6360
  onChanged: changed,
5418
6361
  actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5419
6362
  variant: "ghost",
@@ -5429,38 +6372,38 @@ window.__ModuleLoader__.load({
5429
6372
  }
5430
6373
  //#endregion
5431
6374
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/avatars/AvatarsPage.module.css.mjs
5432
- const css$15 = ".rp_pQOzEG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_pQOzEG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_pQOzEG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_pQOzEG_actions{align-items:center;gap:8px;display:flex}.rp_pQOzEG_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_pQOzEG_grid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_pQOzEG_card{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);align-items:center;gap:4px;min-width:0;padding-right:8px;display:flex}.rp_pQOzEG_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_pQOzEG_open{min-width:0;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:0;flex:auto;align-items:center;gap:12px;padding:10px 0 10px 10px;display:flex}.rp_pQOzEG_open:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_pQOzEG_portrait,.rp_pQOzEG_placeholder{border-radius:var(--dsw-radius-sm);object-fit:cover;flex:none;width:48px;height:48px}.rp_pQOzEG_placeholder{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;font-size:20px;font-weight:500;display:flex}.rp_pQOzEG_text{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_pQOzEG_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_pQOzEG_summary{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.rp_pQOzEG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_pQOzEG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_pQOzEG_editHeader{border-bottom:1px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_pQOzEG_editTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_pQOzEG_editBody{flex:1 1 0;min-height:0;display:flex}.rp_pQOzEG_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_pQOzEG_field{flex-direction:column;gap:6px;min-width:0;display:flex}.rp_pQOzEG_label{color:var(--dsw-alias-label-secondary);font-size:12px}";
5433
- const key$15 = "src/client/pages/avatars/AvatarsPage.module.css";
5434
- let tag$15 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$15) + "]");
5435
- if (tag$15 === null) {
5436
- tag$15 = document.createElement("style");
5437
- tag$15.dataset.plugin = "@dsh-agentic-roleplay/core";
5438
- tag$15.dataset.pluginCss = key$15;
5439
- document.head.appendChild(tag$15);
6375
+ const css$16 = ".rp_pQOzEG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_pQOzEG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_pQOzEG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_pQOzEG_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_pQOzEG_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_pQOzEG_grid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_pQOzEG_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);align-items:center;gap:4px;min-width:0;padding-right:8px;display:flex}.rp_pQOzEG_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_pQOzEG_open{min-width:0;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:0;flex:auto;align-items:center;gap:12px;padding:10px 0 10px 10px;display:flex}.rp_pQOzEG_open:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_pQOzEG_portrait,.rp_pQOzEG_placeholder{border-radius:var(--dsw-radius-lg);object-fit:cover;flex:none;width:48px;height:48px}.rp_pQOzEG_placeholder{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;font-size:20px;font-weight:500;display:flex}.rp_pQOzEG_text{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_pQOzEG_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_pQOzEG_summary{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.rp_pQOzEG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_pQOzEG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_pQOzEG_editHeader{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_pQOzEG_editTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_pQOzEG_editBody{flex:1 1 0;min-height:0;display:flex}.rp_pQOzEG_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_pQOzEG_field{flex-direction:column;gap:6px;min-width:0;display:flex}.rp_pQOzEG_label{color:var(--dsw-alias-label-secondary);font-size:12px}@media (width<=640px){.rp_pQOzEG_toolbar{align-items:flex-start}.rp_pQOzEG_count{padding-top:6px}.rp_pQOzEG_grid{grid-template-columns:1fr}.rp_pQOzEG_form{min-width:0}}";
6376
+ const key$16 = "src/client/pages/avatars/AvatarsPage.module.css";
6377
+ let tag$16 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$16) + "]");
6378
+ if (tag$16 === null) {
6379
+ tag$16 = document.createElement("style");
6380
+ tag$16.dataset.plugin = "@dsh-agentic-roleplay/core";
6381
+ tag$16.dataset.pluginCss = key$16;
6382
+ document.head.appendChild(tag$16);
5440
6383
  }
5441
- tag$15.textContent = css$15;
6384
+ tag$16.textContent = css$16;
5442
6385
  var AvatarsPage_module_css_default = {
5443
6386
  "text": "rp_pQOzEG_text",
5444
- "card": "rp_pQOzEG_card",
5445
- "editHeader": "rp_pQOzEG_editHeader",
5446
- "label": "rp_pQOzEG_label",
5447
- "name": "rp_pQOzEG_name",
5448
- "field": "rp_pQOzEG_field",
5449
- "editTitle": "rp_pQOzEG_editTitle",
5450
- "page": "rp_pQOzEG_page",
5451
- "summary": "rp_pQOzEG_summary",
5452
- "grid": "rp_pQOzEG_grid",
6387
+ "open": "rp_pQOzEG_open",
5453
6388
  "portrait": "rp_pQOzEG_portrait",
5454
- "editBody": "rp_pQOzEG_editBody",
5455
6389
  "form": "rp_pQOzEG_form",
5456
- "actions": "rp_pQOzEG_actions",
6390
+ "field": "rp_pQOzEG_field",
6391
+ "name": "rp_pQOzEG_name",
5457
6392
  "message": "rp_pQOzEG_message",
5458
- "error": "rp_pQOzEG_error",
6393
+ "toolbar": "rp_pQOzEG_toolbar",
6394
+ "label": "rp_pQOzEG_label",
6395
+ "editBody": "rp_pQOzEG_editBody",
5459
6396
  "viewport": "rp_pQOzEG_viewport",
5460
- "count": "rp_pQOzEG_count",
6397
+ "grid": "rp_pQOzEG_grid",
5461
6398
  "placeholder": "rp_pQOzEG_placeholder",
5462
- "open": "rp_pQOzEG_open",
5463
- "toolbar": "rp_pQOzEG_toolbar"
6399
+ "count": "rp_pQOzEG_count",
6400
+ "actions": "rp_pQOzEG_actions",
6401
+ "card": "rp_pQOzEG_card",
6402
+ "error": "rp_pQOzEG_error",
6403
+ "page": "rp_pQOzEG_page",
6404
+ "editHeader": "rp_pQOzEG_editHeader",
6405
+ "editTitle": "rp_pQOzEG_editTitle",
6406
+ "summary": "rp_pQOzEG_summary"
5464
6407
  };
5465
6408
  //#endregion
5466
6409
  //#region src/client/pages/avatars/AvatarsPage.tsx
@@ -5481,7 +6424,9 @@ window.__ModuleLoader__.load({
5481
6424
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
5482
6425
  className: AvatarsPage_module_css_default.portrait,
5483
6426
  src: avatar.portrait,
5484
- alt: ""
6427
+ alt: "",
6428
+ loading: "lazy",
6429
+ decoding: "async"
5485
6430
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5486
6431
  className: AvatarsPage_module_css_default.text,
5487
6432
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -5741,7 +6686,7 @@ window.__ModuleLoader__.load({
5741
6686
  }
5742
6687
  //#endregion
5743
6688
  //#region src/client/widgets/gallery-view/locales.ts
5744
- const dictionaries$9 = {
6689
+ const dictionaries$12 = {
5745
6690
  en: {
5746
6691
  tab: "Gallery",
5747
6692
  notRoleplay: "This chat is not a roleplay session, so it has no gallery.",
@@ -5819,7 +6764,7 @@ window.__ModuleLoader__.load({
5819
6764
  cancel: "取消"
5820
6765
  }
5821
6766
  };
5822
- const dictionaries$8 = withDictionaries({
6767
+ const dictionaries$9 = withDictionaries(withDictionaries(withDictionaries({
5823
6768
  en: {
5824
6769
  language: "en",
5825
6770
  sectionInfo: "About",
@@ -6336,8 +7281,184 @@ window.__ModuleLoader__.load({
6336
7281
  relationCancel: "取消",
6337
7282
  relationCreate: "创建"
6338
7283
  }
6339
- }, prefixed(dictionaries$9, "gallery_"));
6340
- const dictionaries$7 = withDictionaries({
7284
+ }, prefixed(dictionaries$12, "gallery_")), prefixed({
7285
+ en: {
7286
+ title: "Triggers",
7287
+ 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.",
7288
+ helpStory: "What this story does by itself when something comes true, with how often each has fired. They come from the world, or were made in play by the world author.",
7289
+ none: "This world has no triggers.",
7290
+ fileProblem: "triggers.json cannot be shown: {message}",
7291
+ when: "When",
7292
+ then: "Then",
7293
+ problems: "Names something the world does not have",
7294
+ fired: "Fired",
7295
+ firedCount: "fired {count} time(s)",
7296
+ dormant: "Waiting",
7297
+ failed: "Failed",
7298
+ expired: "Expired",
7299
+ fromStory: "Made in play",
7300
+ repeats: "repeats",
7301
+ cooldown: "at least {time} apart",
7302
+ chance: "chance {percent}%",
7303
+ priority: "priority {value}",
7304
+ expires: "ends {at}",
7305
+ announced: "announced beforehand",
7306
+ timeFrom: "from {at}",
7307
+ timeTo: "until {at}",
7308
+ timeWindow: "between {from} and {to} each day",
7309
+ timeDays: "on {days}",
7310
+ place: "{who} is in {where}",
7311
+ placeAt: "{who} is at {feature} in {where}",
7312
+ variable: "{name} {op} {value}",
7313
+ variableOf: "{name} of {subject} {op} {value}",
7314
+ opEq: "is",
7315
+ opNe: "is not",
7316
+ opLt: "is below",
7317
+ opLe: "is at most",
7318
+ opGt: "is above",
7319
+ opGe: "is at least",
7320
+ heldBy: "{item} is held by {who}",
7321
+ lyingIn: "{item} is in {where}",
7322
+ event: "an event tagged “{tag}” was recorded",
7323
+ firedTrigger: "“{trigger}” has fired",
7324
+ judged: "a model judges it true: “{text}”",
7325
+ all: "all of: {parts}",
7326
+ any: "any of: {parts}",
7327
+ not: "not ({part})",
7328
+ edit: "changes the story’s records ({events} event(s))",
7329
+ beat: "tells the game master: “{text}”",
7330
+ cue: "{audience} notice: “{text}”",
7331
+ everyone: "everyone",
7332
+ whoeverIn: "whoever is in {where}",
7333
+ only: "only while {condition}"
7334
+ },
7335
+ zh: {
7336
+ title: "触发器",
7337
+ help: "世界在某件事成真时自行发生的事。它们读自 triggers.json;可以让创作助手来创建或修改,也可以直接编辑该文件。",
7338
+ helpStory: "这个故事在某件事成真时自行发生的事,以及各自触发过几次。它们来自世界,或是世界作者在游玩中创建的。",
7339
+ none: "这个世界没有触发器。",
7340
+ fileProblem: "无法显示 triggers.json:{message}",
7341
+ when: "当",
7342
+ then: "就",
7343
+ problems: "提到了世界里没有的东西",
7344
+ fired: "已触发",
7345
+ firedCount: "已触发 {count} 次",
7346
+ dormant: "等待中",
7347
+ failed: "失败",
7348
+ expired: "已过期",
7349
+ fromStory: "游玩中创建",
7350
+ repeats: "可重复",
7351
+ cooldown: "至少间隔 {time}",
7352
+ chance: "概率 {percent}%",
7353
+ priority: "优先级 {value}",
7354
+ expires: "{at} 结束",
7355
+ announced: "事先公布",
7356
+ timeFrom: "从 {at} 起",
7357
+ timeTo: "到 {at} 为止",
7358
+ timeWindow: "每天 {from} 到 {to}",
7359
+ timeDays: "在{days}",
7360
+ place: "{who}在{where}",
7361
+ placeAt: "{who}在{where}的{feature}",
7362
+ variable: "{name}{op}{value}",
7363
+ variableOf: "{subject}的{name}{op}{value}",
7364
+ opEq: "等于",
7365
+ opNe: "不等于",
7366
+ opLt: "低于",
7367
+ opLe: "不高于",
7368
+ opGt: "高于",
7369
+ opGe: "不低于",
7370
+ heldBy: "{who}持有{item}",
7371
+ lyingIn: "{item}在{where}",
7372
+ event: "记录了带有“{tag}”标签的事件",
7373
+ firedTrigger: "“{trigger}”已触发",
7374
+ judged: "模型判定为真:“{text}”",
7375
+ all: "以下全部成立:{parts}",
7376
+ any: "以下任一成立:{parts}",
7377
+ not: "不满足({part})",
7378
+ edit: "修改故事记录({events} 个事件)",
7379
+ beat: "告诉游戏主持人:“{text}”",
7380
+ cue: "{audience}察觉:“{text}”",
7381
+ everyone: "所有人",
7382
+ whoeverIn: "在{where}的人",
7383
+ only: "仅当{condition}时"
7384
+ }
7385
+ }, "trig_")), prefixed({
7386
+ en: {
7387
+ title: "Interface",
7388
+ help: "The interface packs this world carries: files in its ui folder that restyle the story and add surfaces of their own. Ask the authoring assistant to make or change one. A story of the world gets a copy when it starts.",
7389
+ none: "This world carries no interface pack.",
7390
+ loading: "Reading the packs…",
7391
+ loadFailed: "Could not read the packs: {message}",
7392
+ version: "version {version}",
7393
+ actions: "May act as the player",
7394
+ noActions: "Cannot act as the player",
7395
+ surfaces: "Surfaces",
7396
+ skin: "Skin: {file}",
7397
+ tokens: "{count} theme token(s)",
7398
+ files: "Files",
7399
+ problems: "What is wrong with it",
7400
+ preview: "Preview",
7401
+ previewNote: "Shown with the story the world starts with: its first playable character, where they stand and who is with them. The skin and the theme are applied in a story, not here. Nothing said here is sent anywhere.",
7402
+ previewFailed: "Could not show the preview: {message}",
7403
+ previewBlocked: "A pack with problems cannot be previewed.",
7404
+ hud: "Status strip",
7405
+ dock: "Strip above the input",
7406
+ opening: "Opening card",
7407
+ backdrop: "Backdrop",
7408
+ tab: "Tab",
7409
+ sidebar: "Right sidebar page",
7410
+ surface: "Surface",
7411
+ width: "Width",
7412
+ narrow: "Narrow",
7413
+ medium: "Medium",
7414
+ wide: "Wide",
7415
+ reload: "Reload",
7416
+ log: "What the pack did",
7417
+ logEmpty: "Nothing yet. Press a button in the pack.",
7418
+ logSay: "said as the player: {text}",
7419
+ logFill: "put in the input: {text}",
7420
+ logOpen: "asked to open: {surface}",
7421
+ noSurfaces: "The pack has no surface to preview."
7422
+ },
7423
+ zh: {
7424
+ title: "界面",
7425
+ help: "这个世界携带的界面包:放在它 ui 文件夹里的文件,可以改变故事的外观并添加自己的界面。可以让创作助手来创建或修改。由这个世界开始的故事在开始时会得到一份拷贝。",
7426
+ none: "这个世界没有携带界面包。",
7427
+ loading: "正在读取界面包…",
7428
+ loadFailed: "无法读取界面包:{message}",
7429
+ version: "版本 {version}",
7430
+ actions: "可以代玩家行动",
7431
+ noActions: "不能代玩家行动",
7432
+ surfaces: "界面位置",
7433
+ skin: "皮肤:{file}",
7434
+ tokens: "{count} 个主题颜色",
7435
+ files: "文件",
7436
+ problems: "存在的问题",
7437
+ preview: "预览",
7438
+ previewNote: "以这个世界开始时的故事来显示:第一个可扮演的角色、他所在的位置和身边的人。皮肤和主题在故事里生效,这里不应用。这里说的话不会发到任何地方。",
7439
+ previewFailed: "无法显示预览:{message}",
7440
+ previewBlocked: "有问题的界面包无法预览。",
7441
+ hud: "状态条",
7442
+ dock: "输入框上方的条",
7443
+ opening: "开场卡片",
7444
+ backdrop: "背景",
7445
+ tab: "标签页",
7446
+ sidebar: "右侧栏页面",
7447
+ surface: "界面位置",
7448
+ width: "宽度",
7449
+ narrow: "窄",
7450
+ medium: "中",
7451
+ wide: "宽",
7452
+ reload: "重新载入",
7453
+ log: "界面包的动作",
7454
+ logEmpty: "还没有。请点一下界面包里的按钮。",
7455
+ logSay: "以玩家身份说:{text}",
7456
+ logFill: "填入输入框:{text}",
7457
+ logOpen: "请求打开:{surface}",
7458
+ noSurfaces: "这个界面包没有可预览的界面位置。"
7459
+ }
7460
+ }, "pk_"));
7461
+ const dictionaries$8 = withDictionaries({
6341
7462
  en: {
6342
7463
  nav: "Avatars",
6343
7464
  avatarsLoading: "Loading avatars…",
@@ -6390,14 +7511,14 @@ window.__ModuleLoader__.load({
6390
7511
  avatarDeleteFailed: "无法删除角色形象:{message}",
6391
7512
  avatarEdit: "编辑"
6392
7513
  }
6393
- }, dictionaries$8);
7514
+ }, dictionaries$9);
6394
7515
  //#endregion
6395
7516
  //#region src/client/pages/avatars/index.ts
6396
- const NAMESPACE$8 = "roleplay.avatars";
7517
+ const NAMESPACE$9 = "roleplay.avatars";
6397
7518
  /** Adds the Avatars page to the Role Play panel: characters to play in any world. */
6398
7519
  function registerAvatarsPage(ctx) {
6399
- const t = ctx.locale.bind(NAMESPACE$8);
6400
- ctx.effect(() => ctx.locale.register(NAMESPACE$8, dictionaries$7), "roleplay: avatars dictionaries");
7520
+ const t = ctx.locale.bind(NAMESPACE$9);
7521
+ ctx.effect(() => ctx.locale.register(NAMESPACE$9, dictionaries$8), "roleplay: avatars dictionaries");
6401
7522
  const avatars = new AvatarsController();
6402
7523
  ctx.effect(() => () => {
6403
7524
  avatars.dispose();
@@ -6407,7 +7528,7 @@ window.__ModuleLoader__.load({
6407
7528
  id: "avatars",
6408
7529
  order: 5,
6409
7530
  label: () => t("nav"),
6410
- locale: NAMESPACE$8,
7531
+ locale: NAMESPACE$9,
6411
7532
  inject: () => avatars.inject()
6412
7533
  }, AvatarsPage));
6413
7534
  }
@@ -6441,19 +7562,19 @@ window.__ModuleLoader__.load({
6441
7562
  }
6442
7563
  //#endregion
6443
7564
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/pager/Pager.module.css.mjs
6444
- const css$14 = ".rp_KBAD0W_pager{flex:none;justify-content:center;align-items:center;gap:8px;display:flex}.rp_KBAD0W_position{text-align:center;min-width:120px;color:var(--dsw-alias-label-tertiary);font-size:12px}";
6445
- const key$14 = "src/client/widgets/pager/Pager.module.css";
6446
- let tag$14 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$14) + "]");
6447
- if (tag$14 === null) {
6448
- tag$14 = document.createElement("style");
6449
- tag$14.dataset.plugin = "@dsh-agentic-roleplay/core";
6450
- tag$14.dataset.pluginCss = key$14;
6451
- document.head.appendChild(tag$14);
7565
+ const css$15 = ".rp_KBAD0W_pager{flex:none;justify-content:center;align-items:center;gap:8px;display:flex}.rp_KBAD0W_position{text-align:center;min-width:120px;color:var(--dsw-alias-label-tertiary);font-size:12px}";
7566
+ const key$15 = "src/client/widgets/pager/Pager.module.css";
7567
+ let tag$15 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$15) + "]");
7568
+ if (tag$15 === null) {
7569
+ tag$15 = document.createElement("style");
7570
+ tag$15.dataset.plugin = "@dsh-agentic-roleplay/core";
7571
+ tag$15.dataset.pluginCss = key$15;
7572
+ document.head.appendChild(tag$15);
6452
7573
  }
6453
- tag$14.textContent = css$14;
7574
+ tag$15.textContent = css$15;
6454
7575
  var Pager_module_css_default = {
6455
- "pager": "rp_KBAD0W_pager",
6456
- "position": "rp_KBAD0W_position"
7576
+ "position": "rp_KBAD0W_position",
7577
+ "pager": "rp_KBAD0W_pager"
6457
7578
  };
6458
7579
  //#endregion
6459
7580
  //#region src/client/widgets/pager/Pager.tsx
@@ -6488,16 +7609,16 @@ window.__ModuleLoader__.load({
6488
7609
  }
6489
7610
  //#endregion
6490
7611
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/problem-list/ProblemList.module.css.mjs
6491
- const css$13 = ".rp_LZh3Iq_problems{color:var(--dsw-alias-state-warn-primary);flex:none;font-size:12px}.rp_LZh3Iq_problems summary{cursor:pointer}.rp_LZh3Iq_problems ul{color:var(--dsw-alias-label-secondary);margin:8px 0 0;padding-left:20px}.rp_LZh3Iq_problems code{font-family:var(--dsw-font-mono);color:var(--dsw-alias-label-primary)}";
6492
- const key$13 = "src/client/widgets/problem-list/ProblemList.module.css";
6493
- let tag$13 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$13) + "]");
6494
- if (tag$13 === null) {
6495
- tag$13 = document.createElement("style");
6496
- tag$13.dataset.plugin = "@dsh-agentic-roleplay/core";
6497
- tag$13.dataset.pluginCss = key$13;
6498
- document.head.appendChild(tag$13);
7612
+ const css$14 = ".rp_LZh3Iq_problems{color:var(--dsw-alias-state-warn-primary);flex:none;font-size:12px}.rp_LZh3Iq_problems summary{cursor:pointer}.rp_LZh3Iq_problems ul{color:var(--dsw-alias-label-secondary);margin:8px 0 0;padding-left:20px}.rp_LZh3Iq_problems code{font-family:var(--dsw-font-mono);color:var(--dsw-alias-label-primary)}";
7613
+ const key$14 = "src/client/widgets/problem-list/ProblemList.module.css";
7614
+ let tag$14 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$14) + "]");
7615
+ if (tag$14 === null) {
7616
+ tag$14 = document.createElement("style");
7617
+ tag$14.dataset.plugin = "@dsh-agentic-roleplay/core";
7618
+ tag$14.dataset.pluginCss = key$14;
7619
+ document.head.appendChild(tag$14);
6499
7620
  }
6500
- tag$13.textContent = css$13;
7621
+ tag$14.textContent = css$14;
6501
7622
  var ProblemList_module_css_default = { "problems": "rp_LZh3Iq_problems" };
6502
7623
  //#endregion
6503
7624
  //#region src/client/widgets/problem-list/ProblemList.tsx
@@ -6515,20 +7636,20 @@ window.__ModuleLoader__.load({
6515
7636
  }
6516
7637
  //#endregion
6517
7638
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/sessions/DeleteSessionDialog.module.css.mjs
6518
- const css$12 = ".rp_FifHrW_body{flex-direction:column;gap:8px;min-width:min(380px,100%);display:flex}.rp_FifHrW_body p{margin:0}.rp_FifHrW_question{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;font-size:13px;line-height:20px}.rp_FifHrW_warning{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.rp_FifHrW_error{color:var(--dsw-alias-state-error-primary);font-size:12px}";
6519
- const key$12 = "src/client/pages/sessions/DeleteSessionDialog.module.css";
6520
- let tag$12 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$12) + "]");
6521
- if (tag$12 === null) {
6522
- tag$12 = document.createElement("style");
6523
- tag$12.dataset.plugin = "@dsh-agentic-roleplay/core";
6524
- tag$12.dataset.pluginCss = key$12;
6525
- document.head.appendChild(tag$12);
7639
+ const css$13 = ".rp_FifHrW_body{flex-direction:column;gap:8px;min-width:min(380px,100%);display:flex}.rp_FifHrW_body p{margin:0}.rp_FifHrW_question{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;font-size:13px;line-height:20px}.rp_FifHrW_warning{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.rp_FifHrW_error{color:var(--dsw-alias-state-error-primary);font-size:12px}";
7640
+ const key$13 = "src/client/pages/sessions/DeleteSessionDialog.module.css";
7641
+ let tag$13 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$13) + "]");
7642
+ if (tag$13 === null) {
7643
+ tag$13 = document.createElement("style");
7644
+ tag$13.dataset.plugin = "@dsh-agentic-roleplay/core";
7645
+ tag$13.dataset.pluginCss = key$13;
7646
+ document.head.appendChild(tag$13);
6526
7647
  }
6527
- tag$12.textContent = css$12;
7648
+ tag$13.textContent = css$13;
6528
7649
  var DeleteSessionDialog_module_css_default = {
7650
+ "warning": "rp_FifHrW_warning",
6529
7651
  "body": "rp_FifHrW_body",
6530
7652
  "question": "rp_FifHrW_question",
6531
- "warning": "rp_FifHrW_warning",
6532
7653
  "error": "rp_FifHrW_error"
6533
7654
  };
6534
7655
  //#endregion
@@ -6625,39 +7746,39 @@ window.__ModuleLoader__.load({
6625
7746
  }
6626
7747
  //#endregion
6627
7748
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/sessions/SessionsPage.module.css.mjs
6628
- const css$11 = ".rp_24z4eW_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_24z4eW_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_24z4eW_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_24z4eW_spinning{animation:.9s linear infinite rp_24z4eW_spin}@keyframes rp_24z4eW_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.rp_24z4eW_spinning{animation:none}}.rp_24z4eW_notice{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_24z4eW_viewport{--rp-row-height:40px;--rp-header-height:32px;flex:1 1 0;min-height:0}.rp_24z4eW_scrolls{overflow-y:auto}.rp_24z4eW_fits{overflow:hidden}.rp_24z4eW_table{border-collapse:collapse;table-layout:fixed;width:100%}.rp_24z4eW_actionsColumn{width:132px}.rp_24z4eW_nameColumn{width:30%}.rp_24z4eW_worldColumn{width:26%}.rp_24z4eW_timeColumn{width:16%}.rp_24z4eW_turnsColumn{width:10%}.rp_24z4eW_table th{height:var(--rp-header-height);border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);text-align:left;color:var(--dsw-alias-label-tertiary);padding:0 12px;font-size:12px;font-weight:400;position:sticky;top:0}.rp_24z4eW_table td{height:var(--rp-row-height);border-bottom:1px solid var(--dsw-alias-border-l1);text-overflow:ellipsis;white-space:nowrap;padding:0 12px;font-size:13px;overflow:hidden}.rp_24z4eW_name{color:var(--dsw-alias-label-primary);font-weight:500}.rp_24z4eW_secondary{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_24z4eW_table .rp_24z4eW_number{text-align:right}.rp_24z4eW_table .rp_24z4eW_actions{text-align:center;white-space:nowrap;padding:0 8px}.rp_24z4eW_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_24z4eW_archived td{opacity:.6}.rp_24z4eW_badge{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);margin-left:6px;padding:0 6px;font-size:11px}";
6629
- const key$11 = "src/client/pages/sessions/SessionsPage.module.css";
6630
- let tag$11 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$11) + "]");
6631
- if (tag$11 === null) {
6632
- tag$11 = document.createElement("style");
6633
- tag$11.dataset.plugin = "@dsh-agentic-roleplay/core";
6634
- tag$11.dataset.pluginCss = key$11;
6635
- document.head.appendChild(tag$11);
7749
+ const css$12 = ".rp_24z4eW_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_24z4eW_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_24z4eW_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_24z4eW_spinning{animation:.9s linear infinite rp_24z4eW_spin}@keyframes rp_24z4eW_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.rp_24z4eW_spinning{animation:none}}.rp_24z4eW_notice{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_24z4eW_viewport{--rp-row-height:40px;--rp-header-height:32px;flex:1 1 0;min-height:0;overflow-x:auto}.rp_24z4eW_scrolls{overflow-y:auto}.rp_24z4eW_fits{overflow-y:hidden}.rp_24z4eW_table{border-collapse:collapse;table-layout:fixed;width:100%;min-width:720px}.rp_24z4eW_actionsColumn{width:104px}.rp_24z4eW_nameColumn{width:30%}.rp_24z4eW_worldColumn{width:26%}.rp_24z4eW_timeColumn{width:16%}.rp_24z4eW_turnsColumn{width:10%}.rp_24z4eW_table th{height:var(--rp-header-height);border-bottom:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);text-align:left;color:var(--dsw-alias-label-tertiary);padding:0 12px;font-size:12px;font-weight:400;position:sticky;top:0}.rp_24z4eW_table td{height:var(--rp-row-height);border-bottom:.5px solid var(--dsw-alias-border-l1);text-overflow:ellipsis;white-space:nowrap;padding:0 12px;font-size:13px;overflow:hidden}.rp_24z4eW_name{color:var(--dsw-alias-label-primary);font-weight:500}.rp_24z4eW_secondary{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_24z4eW_table .rp_24z4eW_number{text-align:right}.rp_24z4eW_table .rp_24z4eW_actions{text-align:center;white-space:nowrap;padding:0 8px}.rp_24z4eW_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_24z4eW_archived td{opacity:.6}.rp_24z4eW_badge{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);margin-left:6px;padding:0 6px;font-size:11px}@media (width<=640px){.rp_24z4eW_viewport{--rp-row-height:196px;--rp-header-height:0px;overflow-x:hidden}.rp_24z4eW_table,.rp_24z4eW_table tbody,.rp_24z4eW_table tr,.rp_24z4eW_table td{width:100%;display:block}.rp_24z4eW_table{min-width:0}.rp_24z4eW_table colgroup,.rp_24z4eW_table thead{display:none}.rp_24z4eW_table tr{box-sizing:border-box;min-height:var(--rp-row-height);border-bottom:.5px solid var(--dsw-alias-border-l2);padding:10px 12px}.rp_24z4eW_table td{box-sizing:border-box;text-align:start;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;border:0;grid-template-columns:minmax(88px,34%) minmax(0,1fr);align-items:baseline;height:auto;min-height:24px;padding:2px 0;display:grid;overflow:visible}.rp_24z4eW_table td:before{content:attr(data-label);color:var(--dsw-alias-label-tertiary);padding-inline-end:10px;font-size:11px;font-weight:400}.rp_24z4eW_table .rp_24z4eW_number{text-align:start}.rp_24z4eW_table .rp_24z4eW_actions{justify-content:flex-end;min-height:36px;padding-top:4px;display:flex}.rp_24z4eW_table .rp_24z4eW_actions:before{margin-inline-end:auto}}";
7750
+ const key$12 = "src/client/pages/sessions/SessionsPage.module.css";
7751
+ let tag$12 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$12) + "]");
7752
+ if (tag$12 === null) {
7753
+ tag$12 = document.createElement("style");
7754
+ tag$12.dataset.plugin = "@dsh-agentic-roleplay/core";
7755
+ tag$12.dataset.pluginCss = key$12;
7756
+ document.head.appendChild(tag$12);
6636
7757
  }
6637
- tag$11.textContent = css$11;
7758
+ tag$12.textContent = css$12;
6638
7759
  var SessionsPage_module_css_default = {
7760
+ "badge": "rp_24z4eW_badge",
7761
+ "message": "rp_24z4eW_message",
6639
7762
  "fits": "rp_24z4eW_fits",
6640
- "turnsColumn": "rp_24z4eW_turnsColumn",
6641
- "count": "rp_24z4eW_count",
7763
+ "scrolls": "rp_24z4eW_scrolls",
7764
+ "viewport": "rp_24z4eW_viewport",
6642
7765
  "name": "rp_24z4eW_name",
6643
- "secondary": "rp_24z4eW_secondary",
6644
- "notice": "rp_24z4eW_notice",
7766
+ "spinning": "rp_24z4eW_spinning",
6645
7767
  "number": "rp_24z4eW_number",
6646
- "actions": "rp_24z4eW_actions",
6647
7768
  "archived": "rp_24z4eW_archived",
6648
- "message": "rp_24z4eW_message",
6649
- "spinning": "rp_24z4eW_spinning",
6650
- "timeColumn": "rp_24z4eW_timeColumn",
6651
- "actionsColumn": "rp_24z4eW_actionsColumn",
6652
- "badge": "rp_24z4eW_badge",
6653
- "nameColumn": "rp_24z4eW_nameColumn",
6654
7769
  "toolbar": "rp_24z4eW_toolbar",
7770
+ "nameColumn": "rp_24z4eW_nameColumn",
6655
7771
  "page": "rp_24z4eW_page",
7772
+ "count": "rp_24z4eW_count",
6656
7773
  "spin": "rp_24z4eW_spin",
6657
- "viewport": "rp_24z4eW_viewport",
6658
- "scrolls": "rp_24z4eW_scrolls",
7774
+ "actionsColumn": "rp_24z4eW_actionsColumn",
7775
+ "worldColumn": "rp_24z4eW_worldColumn",
7776
+ "timeColumn": "rp_24z4eW_timeColumn",
7777
+ "notice": "rp_24z4eW_notice",
7778
+ "secondary": "rp_24z4eW_secondary",
6659
7779
  "table": "rp_24z4eW_table",
6660
- "worldColumn": "rp_24z4eW_worldColumn"
7780
+ "actions": "rp_24z4eW_actions",
7781
+ "turnsColumn": "rp_24z4eW_turnsColumn"
6661
7782
  };
6662
7783
  //#endregion
6663
7784
  //#region src/client/pages/sessions/SessionsPage.tsx
@@ -6780,6 +7901,7 @@ window.__ModuleLoader__.load({
6780
7901
  children: [
6781
7902
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
6782
7903
  className: SessionsPage_module_css_default.name,
7904
+ "data-label": t("columnName"),
6783
7905
  title: session.name,
6784
7906
  children: [session.name, session.archivedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6785
7907
  className: SessionsPage_module_css_default.badge,
@@ -6788,23 +7910,28 @@ window.__ModuleLoader__.load({
6788
7910
  }),
6789
7911
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
6790
7912
  className: SessionsPage_module_css_default.secondary,
7913
+ "data-label": t("columnWorld"),
6791
7914
  title: session.worldName,
6792
7915
  children: session.worldName
6793
7916
  }),
6794
7917
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
6795
7918
  className: SessionsPage_module_css_default.secondary,
7919
+ "data-label": t("columnCreated"),
6796
7920
  children: dateTime.format(new Date(session.createdAt))
6797
7921
  }),
6798
7922
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
6799
7923
  className: SessionsPage_module_css_default.secondary,
7924
+ "data-label": t("columnLastPlayed"),
6800
7925
  children: session.lastPlayedAt === void 0 ? t("neverPlayed") : dateTime.format(new Date(session.lastPlayedAt))
6801
7926
  }),
6802
7927
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
6803
7928
  className: `${SessionsPage_module_css_default.secondary} ${SessionsPage_module_css_default.number}`,
7929
+ "data-label": t("columnTurns"),
6804
7930
  children: session.turns
6805
7931
  }),
6806
7932
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
6807
7933
  className: SessionsPage_module_css_default.actions,
7934
+ "data-label": t("columnActions"),
6808
7935
  children: [
6809
7936
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6810
7937
  variant: "ghost",
@@ -6874,7 +8001,7 @@ window.__ModuleLoader__.load({
6874
8001
  }
6875
8002
  //#endregion
6876
8003
  //#region src/client/pages/sessions/locales.ts
6877
- const dictionaries$6 = {
8004
+ const dictionaries$7 = {
6878
8005
  en: {
6879
8006
  nav: "Sessions",
6880
8007
  loading: "Loading sessions…",
@@ -7136,11 +8263,11 @@ window.__ModuleLoader__.load({
7136
8263
  };
7137
8264
  //#endregion
7138
8265
  //#region src/client/pages/sessions/index.ts
7139
- const NAMESPACE$7 = "roleplay.sessions";
8266
+ const NAMESPACE$8 = "roleplay.sessions";
7140
8267
  /** Adds the Sessions page to the Role Play panel. */
7141
8268
  function registerSessionsPage(ctx) {
7142
- const t = ctx.locale.bind(NAMESPACE$7);
7143
- ctx.effect(() => ctx.locale.register(NAMESPACE$7, dictionaries$6), "roleplay: sessions dictionaries");
8269
+ const t = ctx.locale.bind(NAMESPACE$8);
8270
+ ctx.effect(() => ctx.locale.register(NAMESPACE$8, dictionaries$7), "roleplay: sessions dictionaries");
7144
8271
  const sessions = new SessionsController(createChatOpener(ctx));
7145
8272
  ctx.effect(() => () => {
7146
8273
  sessions.dispose();
@@ -7150,33 +8277,33 @@ window.__ModuleLoader__.load({
7150
8277
  id: "sessions",
7151
8278
  order: 10,
7152
8279
  label: () => t("nav"),
7153
- locale: NAMESPACE$7,
8280
+ locale: NAMESPACE$8,
7154
8281
  inject: () => sessions.inject()
7155
8282
  }, SessionsPage));
7156
8283
  }
7157
8284
  //#endregion
7158
8285
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/world-card/WorldCard.module.css.mjs
7159
- const css$10 = ".rp_Bvxx5q_card{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);flex-direction:column;flex:auto;min-width:0;transition:border-color .12s;display:flex;overflow:hidden}.rp_Bvxx5q_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_Bvxx5q_card:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_Bvxx5q_cover{background:var(--dsw-alias-bg-layer-3);flex:1 1 0;min-height:0;position:relative;overflow:hidden}.rp_Bvxx5q_image{object-fit:cover;width:100%;height:100%;display:block}.rp_Bvxx5q_placeholder{color:#ffffffd9;background:linear-gradient(145deg, hsl(var(--rp-hue) 38% 46%), hsl(calc(var(--rp-hue) + 35) 38% 32%));user-select:none;justify-content:center;align-items:center;width:100%;height:100%;font-size:40px;font-weight:500;display:flex}.rp_Bvxx5q_play{color:#fff;opacity:.6;cursor:pointer;background:#00000059;border:0;border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;padding:0;transition:opacity .12s,background-color .12s;display:flex;position:absolute;top:8px;right:8px}.rp_Bvxx5q_card:hover .rp_Bvxx5q_play,.rp_Bvxx5q_play:focus-visible{opacity:1}.rp_Bvxx5q_play:hover{background:#0000008c}.rp_Bvxx5q_play:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_Bvxx5q_info{flex-direction:column;flex:none;gap:4px;padding:8px 10px;display:flex}.rp_Bvxx5q_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.rp_Bvxx5q_tags{gap:4px;display:flex;overflow:hidden;mask-image:linear-gradient(90deg,#000 calc(100% - 20px),#0000)}.rp_Bvxx5q_tag{flex:none}.rp_Bvxx5q_open{cursor:pointer}";
7160
- const key$10 = "src/client/widgets/world-card/WorldCard.module.css";
7161
- let tag$10 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$10) + "]");
7162
- if (tag$10 === null) {
7163
- tag$10 = document.createElement("style");
7164
- tag$10.dataset.plugin = "@dsh-agentic-roleplay/core";
7165
- tag$10.dataset.pluginCss = key$10;
7166
- document.head.appendChild(tag$10);
8286
+ const css$11 = ".rp_Bvxx5q_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;flex:auto;min-width:0;transition:border-color .12s;display:flex;position:relative;overflow:hidden}.rp_Bvxx5q_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_Bvxx5q_card:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_Bvxx5q_cover{background:var(--dsw-alias-bg-layer-3);flex:1 1 0;min-height:0;position:relative;overflow:hidden}.rp_Bvxx5q_image{object-fit:cover;width:100%;height:100%;display:block}.rp_Bvxx5q_placeholder{color:#ffffffd9;background:linear-gradient(145deg, hsl(var(--rp-hue) 38% 46%), hsl(calc(var(--rp-hue) + 35) 38% 32%));user-select:none;justify-content:center;align-items:center;width:100%;height:100%;font-size:40px;font-weight:500;display:flex}.rp_Bvxx5q_play{z-index:2;corner-shape:round;color:#fff;opacity:.6;cursor:pointer;background:#00000059;border:0;border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;padding:0;transition:opacity .12s,background-color .12s;display:flex;position:absolute;top:8px;right:8px}.rp_Bvxx5q_card:hover .rp_Bvxx5q_play,.rp_Bvxx5q_play:focus-visible{opacity:1}.rp_Bvxx5q_play:hover{background:#0000008c}.rp_Bvxx5q_play:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_Bvxx5q_info{flex-direction:column;flex:none;gap:4px;padding:8px 10px;display:flex}.rp_Bvxx5q_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.rp_Bvxx5q_tags{gap:4px;display:flex;overflow:hidden;mask-image:linear-gradient(90deg,#000 calc(100% - 20px),#0000)}.rp_Bvxx5q_tag{flex:none}.rp_Bvxx5q_openButton{z-index:1;border-radius:inherit;cursor:pointer;background:0 0;border:0;width:100%;padding:0;position:absolute;inset:0}.rp_Bvxx5q_openButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:-2px}";
8287
+ const key$11 = "src/client/widgets/world-card/WorldCard.module.css";
8288
+ let tag$11 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$11) + "]");
8289
+ if (tag$11 === null) {
8290
+ tag$11 = document.createElement("style");
8291
+ tag$11.dataset.plugin = "@dsh-agentic-roleplay/core";
8292
+ tag$11.dataset.pluginCss = key$11;
8293
+ document.head.appendChild(tag$11);
7167
8294
  }
7168
- tag$10.textContent = css$10;
8295
+ tag$11.textContent = css$11;
7169
8296
  var WorldCard_module_css_default = {
7170
- "tag": "rp_Bvxx5q_tag",
7171
8297
  "info": "rp_Bvxx5q_info",
8298
+ "name": "rp_Bvxx5q_name",
8299
+ "image": "rp_Bvxx5q_image",
7172
8300
  "placeholder": "rp_Bvxx5q_placeholder",
8301
+ "tags": "rp_Bvxx5q_tags",
7173
8302
  "cover": "rp_Bvxx5q_cover",
7174
- "image": "rp_Bvxx5q_image",
8303
+ "tag": "rp_Bvxx5q_tag",
7175
8304
  "card": "rp_Bvxx5q_card",
7176
8305
  "play": "rp_Bvxx5q_play",
7177
- "tags": "rp_Bvxx5q_tags",
7178
- "name": "rp_Bvxx5q_name",
7179
- "open": "rp_Bvxx5q_open"
8306
+ "openButton": "rp_Bvxx5q_openButton"
7180
8307
  };
7181
8308
  //#endregion
7182
8309
  //#region src/client/widgets/world-card/WorldCard.tsx
@@ -7187,7 +8314,7 @@ window.__ModuleLoader__.load({
7187
8314
  return hash;
7188
8315
  }
7189
8316
  /** A world as a card. It fills the grid cell it is placed in. */
7190
- function WorldCard({ world, playLabel, onPlay, onOpen }) {
8317
+ function WorldCard({ world, playLabel, openLabel, onPlay, onOpen }) {
7191
8318
  const coverSrc = world.coverVersion === void 0 ? void 0 : worldCoverPath(world.id, world.coverVersion);
7192
8319
  const [failedSrc, setFailedSrc] = (0, react.useState)();
7193
8320
  const showCover = coverSrc !== void 0 && coverSrc !== failedSrc;
@@ -7199,81 +8326,81 @@ window.__ModuleLoader__.load({
7199
8326
  portal: true,
7200
8327
  disabled: world.description === "",
7201
8328
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7202
- className: `${WorldCard_module_css_default.card} ${onOpen === void 0 ? "" : WorldCard_module_css_default.open}`,
7203
- tabIndex: 0,
8329
+ className: WorldCard_module_css_default.card,
7204
8330
  "data-testid": "world-card",
7205
- ...onOpen === void 0 ? {} : {
7206
- role: "button",
7207
- onClick: () => {
7208
- onOpen(world);
7209
- },
7210
- onKeyDown: (event) => {
7211
- if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
7212
- event.preventDefault();
8331
+ children: [
8332
+ onOpen !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8333
+ type: "button",
8334
+ className: WorldCard_module_css_default.openButton,
8335
+ "aria-label": openLabel ?? world.name,
8336
+ onClick: () => {
7213
8337
  onOpen(world);
7214
8338
  }
7215
- }
7216
- },
7217
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7218
- className: WorldCard_module_css_default.cover,
7219
- children: [showCover ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
7220
- className: WorldCard_module_css_default.image,
7221
- src: coverSrc,
7222
- alt: "",
7223
- draggable: false,
7224
- onError: () => {
7225
- setFailedSrc(coverSrc);
7226
- }
7227
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7228
- className: WorldCard_module_css_default.placeholder,
7229
- style: { "--rp-hue": hueOf$1(world.name) },
7230
- "aria-hidden": "true",
7231
- children: Array.from(world.name)[0]
7232
- }), onPlay !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7233
- type: "button",
7234
- className: WorldCard_module_css_default.play,
7235
- "aria-label": playLabel,
7236
- "data-testid": "world-play",
7237
- onClick: (event) => {
7238
- event.stopPropagation();
7239
- onPlay(world);
7240
- },
7241
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { size: 14 })
7242
- })]
7243
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7244
- className: WorldCard_module_css_default.info,
7245
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7246
- className: WorldCard_module_css_default.name,
7247
- children: world.name
7248
- }), world.tags.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7249
- className: WorldCard_module_css_default.tags,
7250
- children: world.tags.map((tag) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
7251
- tone: "neutral",
7252
- className: WorldCard_module_css_default.tag,
7253
- children: tag
7254
- }, tag))
7255
- })]
7256
- })]
8339
+ }),
8340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8341
+ className: WorldCard_module_css_default.cover,
8342
+ children: [showCover ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8343
+ className: WorldCard_module_css_default.image,
8344
+ src: coverSrc,
8345
+ alt: "",
8346
+ loading: "lazy",
8347
+ decoding: "async",
8348
+ draggable: false,
8349
+ onError: () => {
8350
+ setFailedSrc(coverSrc);
8351
+ }
8352
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8353
+ className: WorldCard_module_css_default.placeholder,
8354
+ style: { "--rp-hue": hueOf$1(world.name) },
8355
+ "aria-hidden": "true",
8356
+ children: Array.from(world.name)[0]
8357
+ }), onPlay !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8358
+ type: "button",
8359
+ className: WorldCard_module_css_default.play,
8360
+ "aria-label": playLabel,
8361
+ "data-testid": "world-play",
8362
+ onClick: (event) => {
8363
+ event.stopPropagation();
8364
+ onPlay(world);
8365
+ },
8366
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { size: 14 })
8367
+ })]
8368
+ }),
8369
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8370
+ className: WorldCard_module_css_default.info,
8371
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8372
+ className: WorldCard_module_css_default.name,
8373
+ children: world.name
8374
+ }), world.tags.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8375
+ className: WorldCard_module_css_default.tags,
8376
+ children: world.tags.map((tag) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
8377
+ tone: "neutral",
8378
+ className: WorldCard_module_css_default.tag,
8379
+ children: tag
8380
+ }, tag))
8381
+ })]
8382
+ })
8383
+ ]
7257
8384
  })
7258
8385
  });
7259
8386
  }
7260
8387
  //#endregion
7261
8388
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/avatar-choices/AvatarChoices.module.css.mjs
7262
- const css$9 = ".rp_YCstOG_option{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}.rp_YCstOG_option:has(input:checked){border-color:var(--dsw-alias-state-business-primary)}.rp_YCstOG_option input{accent-color:var(--dsw-alias-state-business-primary);margin:3px 0 0}.rp_YCstOG_text{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_YCstOG_name{font-size:13px;font-weight:500}.rp_YCstOG_summary{color:var(--dsw-alias-label-secondary);font-size:12px}";
7263
- const key$9 = "src/client/widgets/avatar-choices/AvatarChoices.module.css";
7264
- let tag$9 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$9) + "]");
7265
- if (tag$9 === null) {
7266
- tag$9 = document.createElement("style");
7267
- tag$9.dataset.plugin = "@dsh-agentic-roleplay/core";
7268
- tag$9.dataset.pluginCss = key$9;
7269
- document.head.appendChild(tag$9);
8389
+ const css$10 = ".rp_YCstOG_option{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}.rp_YCstOG_option:has(input:checked){border-color:var(--dsw-alias-state-business-primary)}.rp_YCstOG_option input{accent-color:var(--dsw-alias-state-business-primary);margin:3px 0 0}.rp_YCstOG_text{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_YCstOG_name{font-size:13px;font-weight:500}.rp_YCstOG_summary{color:var(--dsw-alias-label-secondary);font-size:12px}";
8390
+ const key$10 = "src/client/widgets/avatar-choices/AvatarChoices.module.css";
8391
+ let tag$10 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$10) + "]");
8392
+ if (tag$10 === null) {
8393
+ tag$10 = document.createElement("style");
8394
+ tag$10.dataset.plugin = "@dsh-agentic-roleplay/core";
8395
+ tag$10.dataset.pluginCss = key$10;
8396
+ document.head.appendChild(tag$10);
7270
8397
  }
7271
- tag$9.textContent = css$9;
8398
+ tag$10.textContent = css$10;
7272
8399
  var AvatarChoices_module_css_default = {
7273
8400
  "option": "rp_YCstOG_option",
7274
- "name": "rp_YCstOG_name",
7275
8401
  "text": "rp_YCstOG_text",
7276
- "summary": "rp_YCstOG_summary"
8402
+ "summary": "rp_YCstOG_summary",
8403
+ "name": "rp_YCstOG_name"
7277
8404
  };
7278
8405
  //#endregion
7279
8406
  //#region src/client/widgets/avatar-choices/AvatarChoices.tsx
@@ -7302,29 +8429,29 @@ window.__ModuleLoader__.load({
7302
8429
  }
7303
8430
  //#endregion
7304
8431
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/worlds/StartSessionDialog.module.css.mjs
7305
- const css$8 = ".rp_AnbLKG_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_AnbLKG_field{border:0;flex-direction:column;gap:6px;min-width:0;margin:0;padding:0;display:flex}.rp_AnbLKG_label{color:var(--dsw-alias-label-secondary);padding:0;font-size:12px}.rp_AnbLKG_option{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}.rp_AnbLKG_option:has(input:checked){border-color:var(--dsw-alias-state-business-primary)}.rp_AnbLKG_option input{accent-color:var(--dsw-alias-state-business-primary);margin:3px 0 0}.rp_AnbLKG_optionText{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_AnbLKG_optionName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:20px}.rp_AnbLKG_optionSummary{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.rp_AnbLKG_message{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_AnbLKG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_AnbLKG_advanced{flex-direction:column;gap:8px;display:flex}.rp_AnbLKG_advancedToggle{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;align-self:flex-start;align-items:center;gap:6px;padding:0;font-size:12px;display:inline-flex}.rp_AnbLKG_advancedToggle:hover{color:var(--dsw-alias-label-primary)}.rp_AnbLKG_advancedBody{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);flex-direction:column;gap:12px;max-height:320px;padding:12px;display:flex;overflow-y:auto}";
7306
- const key$8 = "src/client/pages/worlds/StartSessionDialog.module.css";
7307
- let tag$8 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$8) + "]");
7308
- if (tag$8 === null) {
7309
- tag$8 = document.createElement("style");
7310
- tag$8.dataset.plugin = "@dsh-agentic-roleplay/core";
7311
- tag$8.dataset.pluginCss = key$8;
7312
- document.head.appendChild(tag$8);
8432
+ const css$9 = ".rp_AnbLKG_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_AnbLKG_field{border:0;flex-direction:column;gap:6px;min-width:0;margin:0;padding:0;display:flex}.rp_AnbLKG_label{color:var(--dsw-alias-label-secondary);padding:0;font-size:12px}.rp_AnbLKG_option{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}.rp_AnbLKG_option:has(input:checked){border-color:var(--dsw-alias-state-business-primary)}.rp_AnbLKG_option input{accent-color:var(--dsw-alias-state-business-primary);margin:3px 0 0}.rp_AnbLKG_optionText{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_AnbLKG_optionName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:20px}.rp_AnbLKG_optionSummary{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.rp_AnbLKG_message{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_AnbLKG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_AnbLKG_advanced{flex-direction:column;gap:8px;display:flex}.rp_AnbLKG_advancedToggle{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;align-self:flex-start;align-items:center;gap:6px;padding:0;font-size:12px;display:inline-flex}.rp_AnbLKG_advancedToggle:hover{color:var(--dsw-alias-label-primary)}.rp_AnbLKG_advancedBody{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:12px;max-height:320px;padding:12px;display:flex;overflow-y:auto}@media (width<=520px){.rp_AnbLKG_form{min-width:0}}";
8433
+ const key$9 = "src/client/pages/worlds/StartSessionDialog.module.css";
8434
+ let tag$9 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$9) + "]");
8435
+ if (tag$9 === null) {
8436
+ tag$9 = document.createElement("style");
8437
+ tag$9.dataset.plugin = "@dsh-agentic-roleplay/core";
8438
+ tag$9.dataset.pluginCss = key$9;
8439
+ document.head.appendChild(tag$9);
7313
8440
  }
7314
- tag$8.textContent = css$8;
8441
+ tag$9.textContent = css$9;
7315
8442
  var StartSessionDialog_module_css_default = {
7316
- "message": "rp_AnbLKG_message",
7317
- "optionSummary": "rp_AnbLKG_optionSummary",
8443
+ "advancedToggle": "rp_AnbLKG_advancedToggle",
8444
+ "option": "rp_AnbLKG_option",
7318
8445
  "optionName": "rp_AnbLKG_optionName",
7319
- "optionText": "rp_AnbLKG_optionText",
7320
- "advancedBody": "rp_AnbLKG_advancedBody",
8446
+ "optionSummary": "rp_AnbLKG_optionSummary",
8447
+ "message": "rp_AnbLKG_message",
7321
8448
  "label": "rp_AnbLKG_label",
7322
8449
  "field": "rp_AnbLKG_field",
7323
8450
  "error": "rp_AnbLKG_error",
7324
- "form": "rp_AnbLKG_form",
8451
+ "optionText": "rp_AnbLKG_optionText",
7325
8452
  "advanced": "rp_AnbLKG_advanced",
7326
- "advancedToggle": "rp_AnbLKG_advancedToggle",
7327
- "option": "rp_AnbLKG_option"
8453
+ "advancedBody": "rp_AnbLKG_advancedBody",
8454
+ "form": "rp_AnbLKG_form"
7328
8455
  };
7329
8456
  //#endregion
7330
8457
  //#region src/client/pages/worlds/AddAvatarsDialog.tsx
@@ -7459,7 +8586,9 @@ window.__ModuleLoader__.load({
7459
8586
  lookupCalls: integer(1, 20, 5),
7460
8587
  verify: flag(true),
7461
8588
  backlogRounds: integer(1, 100, 6),
7462
- overRetrieve: integer(1, 10, 4)
8589
+ overRetrieve: integer(1, 10, 4),
8590
+ associate: integer(0, 10, 2),
8591
+ diversity: ratio(0, 1, .3)
7463
8592
  },
7464
8593
  context: {
7465
8594
  limitTokens: integer(0, 1e6, 0),
@@ -7480,6 +8609,7 @@ window.__ModuleLoader__.load({
7480
8609
  roundSeconds: integer(0, 3600, 30),
7481
8610
  maxSkipDays: integer(1, 3650, 30)
7482
8611
  },
8612
+ diagnostics: { keepRuns: flag(false) },
7483
8613
  offstage: {
7484
8614
  perTurn: integer(0, 5, 2),
7485
8615
  perCharacter: integer(1, 3, 1),
@@ -7489,12 +8619,13 @@ window.__ModuleLoader__.load({
7489
8619
  sampling: {
7490
8620
  master: ratio(0, 2, .7),
7491
8621
  characters: ratio(0, 2, .8),
7492
- suggestions: ratio(0, 2, .8),
8622
+ suggestions: ratio(0, 2, .2),
7493
8623
  authoring: ratio(0, 2, .4),
7494
8624
  records: ratio(0, 2, .1),
7495
8625
  tools: choice(["auto", "required"], "required"),
7496
8626
  maxTokens: integer(256, 64e3, 8e3),
7497
- shortMaxTokens: integer(256, 64e3, 2e3)
8627
+ shortMaxTokens: integer(256, 64e3, 2e3),
8628
+ headroom: ratio(1, 10, 2)
7498
8629
  },
7499
8630
  prompts: { language: text(8, "en") },
7500
8631
  reasoning: { children: text(40, "") },
@@ -7502,8 +8633,18 @@ window.__ModuleLoader__.load({
7502
8633
  perTurn: integer(0, 3, 1),
7503
8634
  everyDays: integer(1, 365, 3)
7504
8635
  },
8636
+ reflection: {
8637
+ auto: flag(true),
8638
+ everyTurns: integer(0, 500, 20),
8639
+ onSceneChange: flag(true),
8640
+ sceneDays: integer(0, 365, 1),
8641
+ minTurns: integer(1, 100, 5),
8642
+ perRun: integer(1, 6, 3),
8643
+ minNew: integer(1, 50, 4)
8644
+ },
7505
8645
  models: {
7506
8646
  characters: text(200, ""),
8647
+ background: text(200, ""),
7507
8648
  records: text(200, ""),
7508
8649
  suggestions: text(200, ""),
7509
8650
  authoring: text(200, "")
@@ -7515,6 +8656,7 @@ window.__ModuleLoader__.load({
7515
8656
  cueTurns: integer(1, 20, 2),
7516
8657
  judgedPerTurn: integer(0, 5, 2)
7517
8658
  },
8659
+ interface: { pack: text(60, "") },
7518
8660
  rewind: { keepSnapshots: integer(0, 500, 30) },
7519
8661
  rules: { own: text(MAX_OWN_RULES, "") },
7520
8662
  preview: { enabled: flag(true) },
@@ -7589,6 +8731,18 @@ window.__ModuleLoader__.load({
7589
8731
  label: "overRetrieve",
7590
8732
  help: "overRetrieveHelp"
7591
8733
  },
8734
+ {
8735
+ path: ["memory", "associate"],
8736
+ kind: "integer",
8737
+ label: "associate",
8738
+ help: "associateHelp"
8739
+ },
8740
+ {
8741
+ path: ["memory", "diversity"],
8742
+ kind: "decimal",
8743
+ label: "diversity",
8744
+ help: "diversityHelp"
8745
+ },
7592
8746
  {
7593
8747
  path: ["memory", "lookup"],
7594
8748
  kind: "flag",
@@ -7708,15 +8862,65 @@ window.__ModuleLoader__.load({
7708
8862
  help: "factionsEveryDaysHelp"
7709
8863
  },
7710
8864
  {
7711
- path: ["models", "characters"],
7712
- kind: "text",
7713
- label: "modelsCharacters",
7714
- help: "modelsCharactersHelp",
7715
- zone: false,
7716
- placeholder: "localai/model-id"
8865
+ path: ["reflection", "auto"],
8866
+ kind: "flag",
8867
+ label: "reflectionAuto",
8868
+ help: "reflectionAutoHelp"
7717
8869
  },
7718
8870
  {
7719
- path: ["models", "records"],
8871
+ path: ["reflection", "everyTurns"],
8872
+ kind: "integer",
8873
+ label: "reflectionEveryTurns",
8874
+ help: "reflectionEveryTurnsHelp"
8875
+ },
8876
+ {
8877
+ path: ["reflection", "onSceneChange"],
8878
+ kind: "flag",
8879
+ label: "reflectionOnScene",
8880
+ help: "reflectionOnSceneHelp"
8881
+ },
8882
+ {
8883
+ path: ["reflection", "sceneDays"],
8884
+ kind: "integer",
8885
+ label: "reflectionSceneDays",
8886
+ help: "reflectionSceneDaysHelp"
8887
+ },
8888
+ {
8889
+ path: ["reflection", "minTurns"],
8890
+ kind: "integer",
8891
+ label: "reflectionMinTurns",
8892
+ help: "reflectionMinTurnsHelp"
8893
+ },
8894
+ {
8895
+ path: ["reflection", "perRun"],
8896
+ kind: "integer",
8897
+ label: "reflectionPerRun",
8898
+ help: "reflectionPerRunHelp"
8899
+ },
8900
+ {
8901
+ path: ["reflection", "minNew"],
8902
+ kind: "integer",
8903
+ label: "reflectionMinNew",
8904
+ help: "reflectionMinNewHelp"
8905
+ },
8906
+ {
8907
+ path: ["models", "characters"],
8908
+ kind: "text",
8909
+ label: "modelsCharacters",
8910
+ help: "modelsCharactersHelp",
8911
+ zone: false,
8912
+ placeholder: "localai/model-id"
8913
+ },
8914
+ {
8915
+ path: ["models", "background"],
8916
+ kind: "text",
8917
+ label: "modelsBackground",
8918
+ help: "modelsBackgroundHelp",
8919
+ zone: false,
8920
+ placeholder: "localai/model-id"
8921
+ },
8922
+ {
8923
+ path: ["models", "records"],
7720
8924
  kind: "text",
7721
8925
  label: "modelsRecords",
7722
8926
  help: "modelsRecordsHelp",
@@ -7926,6 +9130,20 @@ window.__ModuleLoader__.load({
7926
9130
  kind: "percent",
7927
9131
  label: "retainRatio",
7928
9132
  help: "retainRatioHelp"
9133
+ },
9134
+ {
9135
+ path: ["interface", "pack"],
9136
+ kind: "text",
9137
+ label: "interfacePack",
9138
+ help: "interfacePackHelp",
9139
+ zone: false,
9140
+ placeholder: "none"
9141
+ },
9142
+ {
9143
+ path: ["diagnostics", "keepRuns"],
9144
+ kind: "flag",
9145
+ label: "diagnosticsKeepRuns",
9146
+ help: "diagnosticsKeepRunsHelp"
7929
9147
  }
7930
9148
  ];
7931
9149
  /**
@@ -7940,10 +9158,11 @@ window.__ModuleLoader__.load({
7940
9158
  maxRounds: "2",
7941
9159
  maxCharacters: "3",
7942
9160
  "offstage.perTurn": "0",
7943
- "authoring.enabled": false
9161
+ "authoring.enabled": false,
9162
+ "reflection.auto": false
7944
9163
  };
7945
9164
  const keyOf = (field) => field.path.join(".");
7946
- function read(root, path) {
9165
+ function read$1(root, path) {
7947
9166
  return path.reduce((node, key) => node[key], root);
7948
9167
  }
7949
9168
  /** The key of the draft of one request option of the embedding provider. */
@@ -7951,7 +9170,7 @@ window.__ModuleLoader__.load({
7951
9170
  /** What each setting of the form starts as, and each request option the embedding provider offers. */
7952
9171
  function toDrafts(settings, options = []) {
7953
9172
  const fixed = FORM_FIELDS.map((field) => {
7954
- const value = read(settings, field.path);
9173
+ const value = read$1(settings, field.path);
7955
9174
  return [keyOf(field), field.kind === "flag" ? value === true : field.kind === "percent" ? String(Math.round(value * 100)) : String(value)];
7956
9175
  });
7957
9176
  const requested = options.map((option) => {
@@ -7962,7 +9181,7 @@ window.__ModuleLoader__.load({
7962
9181
  }
7963
9182
  /** The bounds of a field as the form shows them: percentages for a share. */
7964
9183
  function boundsOf(field) {
7965
- const spec = read(SETTINGS_SPEC, field.path);
9184
+ const spec = read$1(SETTINGS_SPEC, field.path);
7966
9185
  return field.kind === "percent" ? {
7967
9186
  min: Math.round((spec.min ?? 0) * 100),
7968
9187
  max: Math.round((spec.max ?? 1) * 100)
@@ -8071,30 +9290,30 @@ window.__ModuleLoader__.load({
8071
9290
  }
8072
9291
  //#endregion
8073
9292
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/settings-form/SettingsFields.module.css.mjs
8074
- const css$7 = ".rp_Rhi3yq_row{flex-direction:column;gap:6px;display:flex}.rp_Rhi3yq_field{flex-direction:column;gap:6px;max-width:200px;display:flex}.rp_Rhi3yq_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_Rhi3yq_help{max-width:560px;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_Rhi3yq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_Rhi3yq_group{border-top:1px solid var(--dsw-alias-border-l3);flex-direction:column;gap:12px;padding-top:12px;display:flex}.rp_Rhi3yq_groupTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500}.rp_Rhi3yq_area{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:100%;max-width:560px;color:inherit;font:inherit;resize:vertical;background:0 0;padding:6px 8px;font-size:13px}";
8075
- const key$7 = "src/client/settings-form/SettingsFields.module.css";
8076
- let tag$7 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$7) + "]");
8077
- if (tag$7 === null) {
8078
- tag$7 = document.createElement("style");
8079
- tag$7.dataset.plugin = "@dsh-agentic-roleplay/core";
8080
- tag$7.dataset.pluginCss = key$7;
8081
- document.head.appendChild(tag$7);
9293
+ const css$8 = ".rp_Rhi3yq_row{flex-direction:column;gap:6px;display:flex}.rp_Rhi3yq_field{flex-direction:column;gap:6px;width:min(100%,320px);display:flex}.rp_Rhi3yq_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_Rhi3yq_help{max-width:560px;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_Rhi3yq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_Rhi3yq_group{border-top:.5px solid var(--dsw-alias-border-l3);flex-direction:column;gap:12px;padding-top:12px;display:flex}.rp_Rhi3yq_groupTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500}.rp_Rhi3yq_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%;max-width:560px;min-height:96px;color:inherit;font:inherit;resize:vertical;padding:6px 8px;font-size:13px}.rp_Rhi3yq_area:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}";
9294
+ const key$8 = "src/client/settings-form/SettingsFields.module.css";
9295
+ let tag$8 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$8) + "]");
9296
+ if (tag$8 === null) {
9297
+ tag$8 = document.createElement("style");
9298
+ tag$8.dataset.plugin = "@dsh-agentic-roleplay/core";
9299
+ tag$8.dataset.pluginCss = key$8;
9300
+ document.head.appendChild(tag$8);
8082
9301
  }
8083
- tag$7.textContent = css$7;
9302
+ tag$8.textContent = css$8;
8084
9303
  var SettingsFields_module_css_default = {
8085
- "group": "rp_Rhi3yq_group",
8086
- "groupTitle": "rp_Rhi3yq_groupTitle",
8087
- "label": "rp_Rhi3yq_label",
8088
- "area": "rp_Rhi3yq_area",
8089
9304
  "row": "rp_Rhi3yq_row",
8090
9305
  "field": "rp_Rhi3yq_field",
9306
+ "label": "rp_Rhi3yq_label",
9307
+ "group": "rp_Rhi3yq_group",
9308
+ "error": "rp_Rhi3yq_error",
9309
+ "area": "rp_Rhi3yq_area",
8091
9310
  "help": "rp_Rhi3yq_help",
8092
- "error": "rp_Rhi3yq_error"
9311
+ "groupTitle": "rp_Rhi3yq_groupTitle"
8093
9312
  };
8094
9313
  //#endregion
8095
9314
  //#region src/client/settings-form/SettingsFields.tsx
8096
9315
  /** The settings of a chat as editable fields: one control with its explanation under each. */
8097
- function SettingsFields({ t, drafts, onChange, onPreset, options = [], disabled = false, locked = {} }) {
9316
+ function SettingsFields({ t, drafts, onChange, onPreset, options = [], disabled = false, locked = {}, hidden = [] }) {
8098
9317
  const bad = problemsOf(drafts, options);
8099
9318
  const locale = t("localeId");
8100
9319
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
@@ -8120,7 +9339,7 @@ window.__ModuleLoader__.load({
8120
9339
  children: t("presetFastHelp")
8121
9340
  })]
8122
9341
  }),
8123
- FORM_FIELDS.map((field) => {
9342
+ FORM_FIELDS.filter((field) => !hidden.includes(keyOf(field))).map((field) => {
8124
9343
  const key = keyOf(field);
8125
9344
  const { min, max } = field.kind === "choice" || field.kind === "text" ? {
8126
9345
  min: 0,
@@ -8657,36 +9876,36 @@ window.__ModuleLoader__.load({
8657
9876
  }
8658
9877
  //#endregion
8659
9878
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/worlds/WorldsPage.module.css.mjs
8660
- const css$6 = ".rp_FHUyRq_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_FHUyRq_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_FHUyRq_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_FHUyRq_toolbarActions{align-items:center;gap:8px;display:flex}.rp_FHUyRq_spinning{animation:.9s linear infinite rp_FHUyRq_spin}@keyframes rp_FHUyRq_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.rp_FHUyRq_spinning{animation:none}}.rp_FHUyRq_notice{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_FHUyRq_viewport{--rp-card-width:168px;--rp-card-height:288px;--rp-card-gap:16px;flex:1 1 0;min-height:0;padding:4px}.rp_FHUyRq_scrolls{overflow-y:auto}.rp_FHUyRq_fits{overflow:hidden}.rp_FHUyRq_grid{grid-auto-rows:var(--rp-card-height);grid-template-columns:repeat(auto-fill, var(--rp-card-width));gap:var(--rp-card-gap);margin:0;padding:0;list-style:none;display:grid}.rp_FHUyRq_cell{min-width:0;display:flex}.rp_FHUyRq_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_FHUyRq_editHeader{border-bottom:1px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_FHUyRq_editTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_FHUyRq_authorButton{margin-left:auto}.rp_FHUyRq_editBody{flex:1 1 0;min-height:0;display:flex}.rp_FHUyRq_starters{flex-direction:column;align-items:center;gap:8px;padding-bottom:24px;display:flex}.rp_FHUyRq_starter{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);text-align:center;max-width:480px;color:var(--dsw-alias-label-secondary);flex-direction:column;align-items:center;gap:6px;padding:12px 16px;font-size:13px;display:flex}";
8661
- const key$6 = "src/client/pages/worlds/WorldsPage.module.css";
8662
- let tag$6 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$6) + "]");
8663
- if (tag$6 === null) {
8664
- tag$6 = document.createElement("style");
8665
- tag$6.dataset.plugin = "@dsh-agentic-roleplay/core";
8666
- tag$6.dataset.pluginCss = key$6;
8667
- document.head.appendChild(tag$6);
9879
+ const css$7 = ".rp_FHUyRq_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_FHUyRq_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_FHUyRq_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_FHUyRq_toolbarActions{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;display:flex}.rp_FHUyRq_spinning{animation:.9s linear infinite rp_FHUyRq_spin}@keyframes rp_FHUyRq_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.rp_FHUyRq_spinning{animation:none}}.rp_FHUyRq_notice{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_FHUyRq_viewport{--rp-card-width:168px;--rp-card-height:288px;--rp-card-gap:16px;flex:1 1 0;min-height:0;padding:4px}.rp_FHUyRq_scrolls{overflow-y:auto}.rp_FHUyRq_fits{overflow:hidden}.rp_FHUyRq_grid{grid-auto-rows:var(--rp-card-height);grid-template-columns:repeat(auto-fill, var(--rp-card-width));gap:var(--rp-card-gap);margin:0;padding:0;list-style:none;display:grid}.rp_FHUyRq_cell{min-width:0;display:flex}.rp_FHUyRq_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_FHUyRq_editHeader{border-bottom:.5px solid var(--dsw-alias-border-l3);flex-wrap:wrap;flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_FHUyRq_editTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_FHUyRq_authorButton{margin-left:auto}.rp_FHUyRq_editBody{flex:1 1 0;min-height:0;display:flex}.rp_FHUyRq_starters{flex-direction:column;align-items:center;gap:8px;padding-bottom:24px;display:flex}.rp_FHUyRq_starter{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);text-align:center;max-width:480px;color:var(--dsw-alias-label-secondary);flex-direction:column;align-items:center;gap:6px;padding:12px 16px;font-size:13px;display:flex}@media (width<=640px){.rp_FHUyRq_toolbar{align-items:flex-start}.rp_FHUyRq_count{padding-top:6px}.rp_FHUyRq_toolbarActions{max-width:75%}.rp_FHUyRq_editTitle{text-overflow:ellipsis;white-space:nowrap;flex:calc(100% - 96px);overflow:hidden}.rp_FHUyRq_authorButton{margin-left:0}}";
9880
+ const key$7 = "src/client/pages/worlds/WorldsPage.module.css";
9881
+ let tag$7 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$7) + "]");
9882
+ if (tag$7 === null) {
9883
+ tag$7 = document.createElement("style");
9884
+ tag$7.dataset.plugin = "@dsh-agentic-roleplay/core";
9885
+ tag$7.dataset.pluginCss = key$7;
9886
+ document.head.appendChild(tag$7);
8668
9887
  }
8669
- tag$6.textContent = css$6;
9888
+ tag$7.textContent = css$7;
8670
9889
  var WorldsPage_module_css_default = {
9890
+ "editBody": "rp_FHUyRq_editBody",
9891
+ "grid": "rp_FHUyRq_grid",
8671
9892
  "viewport": "rp_FHUyRq_viewport",
8672
9893
  "starters": "rp_FHUyRq_starters",
8673
- "message": "rp_FHUyRq_message",
8674
- "spin": "rp_FHUyRq_spin",
9894
+ "editHeader": "rp_FHUyRq_editHeader",
8675
9895
  "notice": "rp_FHUyRq_notice",
8676
- "grid": "rp_FHUyRq_grid",
9896
+ "spin": "rp_FHUyRq_spin",
9897
+ "scrolls": "rp_FHUyRq_scrolls",
9898
+ "fits": "rp_FHUyRq_fits",
8677
9899
  "editTitle": "rp_FHUyRq_editTitle",
8678
- "editBody": "rp_FHUyRq_editBody",
8679
- "page": "rp_FHUyRq_page",
8680
- "toolbar": "rp_FHUyRq_toolbar",
8681
- "spinning": "rp_FHUyRq_spinning",
9900
+ "starter": "rp_FHUyRq_starter",
9901
+ "toolbarActions": "rp_FHUyRq_toolbarActions",
8682
9902
  "count": "rp_FHUyRq_count",
8683
- "editHeader": "rp_FHUyRq_editHeader",
8684
- "cell": "rp_FHUyRq_cell",
9903
+ "spinning": "rp_FHUyRq_spinning",
8685
9904
  "authorButton": "rp_FHUyRq_authorButton",
8686
- "fits": "rp_FHUyRq_fits",
8687
- "toolbarActions": "rp_FHUyRq_toolbarActions",
8688
- "scrolls": "rp_FHUyRq_scrolls",
8689
- "starter": "rp_FHUyRq_starter"
9905
+ "cell": "rp_FHUyRq_cell",
9906
+ "message": "rp_FHUyRq_message",
9907
+ "page": "rp_FHUyRq_page",
9908
+ "toolbar": "rp_FHUyRq_toolbar"
8690
9909
  };
8691
9910
  //#endregion
8692
9911
  //#region src/client/pages/worlds/StarterWorlds.tsx
@@ -8785,45 +10004,45 @@ window.__ModuleLoader__.load({
8785
10004
  const pictureUrl = (id) => `${API_PREFIX}/worlds/import/picture?id=${encodeURIComponent(id)}`;
8786
10005
  //#endregion
8787
10006
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/worlds/ImportCardPage.module.css.mjs
8788
- const css$5 = ".rp_DmG_oG_page{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_DmG_oG_header{border-bottom:1px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_DmG_oG_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_DmG_oG_space{flex:auto}.rp_DmG_oG_error{color:var(--dsw-alias-state-error-primary);margin:0;padding:8px 16px;font-size:12px}.rp_DmG_oG_body{box-sizing:border-box;flex-direction:column;flex:1 1 0;gap:20px;min-height:0;padding:20px 24px 40px;display:flex;overflow-y:auto}.rp_DmG_oG_body>*{flex:none;width:100%;max-width:860px}.rp_DmG_oG_top{align-items:flex-start;gap:20px;display:flex}.rp_DmG_oG_picture{object-fit:cover;border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);flex:0 0 120px;width:120px;height:160px}.rp_DmG_oG_noPicture{box-sizing:border-box;color:var(--dsw-alias-label-tertiary);justify-content:center;align-items:center;font-size:12px;display:flex}.rp_DmG_oG_about{flex-direction:column;flex:1 1 0;gap:8px;min-width:0;display:flex}.rp_DmG_oG_label{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:4px;font-size:12px;display:flex}.rp_DmG_oG_tags{flex-wrap:wrap;gap:6px;display:flex}.rp_DmG_oG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_DmG_oG_section{flex-direction:column;gap:8px;display:flex}.rp_DmG_oG_heading{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500}.rp_DmG_oG_row{align-items:center;gap:8px;display:flex}.rp_DmG_oG_field,.rp_DmG_oG_entry{border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm)}.rp_DmG_oG_fieldHead,.rp_DmG_oG_entryHead{box-sizing:border-box;width:100%;font:inherit;text-align:left;color:inherit;background:0 0;border:0;align-items:center;gap:8px;padding:8px 10px;display:flex}.rp_DmG_oG_fieldHead{cursor:pointer}.rp_DmG_oG_fieldTitle,.rp_DmG_oG_entryTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:auto;font-size:13px}.rp_DmG_oG_entryTitle{font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0;font-size:13px}.rp_DmG_oG_fieldMeta{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_DmG_oG_field .rp_DmG_oG_note,.rp_DmG_oG_entry .rp_DmG_oG_note{padding:0 10px 6px}.rp_DmG_oG_text{white-space:pre-wrap;word-break:break-word;max-height:320px;font:inherit;color:var(--dsw-alias-label-secondary);border-top:1px solid var(--dsw-alias-border-l4);margin:0;padding:8px 10px 10px;font-size:12px;line-height:18px;overflow:auto}.rp_DmG_oG_entryOff .rp_DmG_oG_entryTitle{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}.rp_DmG_oG_choice{border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}.rp_DmG_oG_choice input{margin-top:3px}.rp_DmG_oG_choiceText{flex-direction:column;gap:4px;min-width:0;display:flex}.rp_DmG_oG_preview{white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}";
8789
- const key$5 = "src/client/pages/worlds/ImportCardPage.module.css";
8790
- let tag$5 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$5) + "]");
8791
- if (tag$5 === null) {
8792
- tag$5 = document.createElement("style");
8793
- tag$5.dataset.plugin = "@dsh-agentic-roleplay/core";
8794
- tag$5.dataset.pluginCss = key$5;
8795
- document.head.appendChild(tag$5);
10007
+ const css$6 = ".rp_DmG_oG_page{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_DmG_oG_header{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_DmG_oG_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_DmG_oG_space{flex:auto}.rp_DmG_oG_error{color:var(--dsw-alias-state-error-primary);margin:0;padding:8px 16px;font-size:12px}.rp_DmG_oG_body{box-sizing:border-box;flex-direction:column;flex:1 1 0;gap:20px;min-height:0;padding:20px 24px 40px;display:flex;overflow-y:auto}.rp_DmG_oG_body>*{flex:none;width:100%;max-width:860px}.rp_DmG_oG_top{align-items:flex-start;gap:20px;display:flex}.rp_DmG_oG_picture{object-fit:cover;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);flex:0 0 120px;width:120px;height:160px}.rp_DmG_oG_noPicture{box-sizing:border-box;color:var(--dsw-alias-label-tertiary);justify-content:center;align-items:center;font-size:12px;display:flex}.rp_DmG_oG_about{flex-direction:column;flex:1 1 0;gap:8px;min-width:0;display:flex}.rp_DmG_oG_label{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:4px;font-size:12px;display:flex}.rp_DmG_oG_tags{flex-wrap:wrap;gap:6px;display:flex}.rp_DmG_oG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_DmG_oG_section{flex-direction:column;gap:8px;display:flex}.rp_DmG_oG_heading{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500}.rp_DmG_oG_row{align-items:center;gap:8px;display:flex}.rp_DmG_oG_field,.rp_DmG_oG_entry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg)}.rp_DmG_oG_fieldHead,.rp_DmG_oG_entryHead{box-sizing:border-box;width:100%;font:inherit;text-align:left;color:inherit;background:0 0;border:0;align-items:center;gap:8px;padding:8px 10px;display:flex}.rp_DmG_oG_fieldHead{cursor:pointer}.rp_DmG_oG_fieldTitle,.rp_DmG_oG_entryTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:auto;font-size:13px}.rp_DmG_oG_entryTitle{font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0;font-size:13px}.rp_DmG_oG_fieldMeta{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_DmG_oG_field .rp_DmG_oG_note,.rp_DmG_oG_entry .rp_DmG_oG_note{padding:0 10px 6px}.rp_DmG_oG_text{white-space:pre-wrap;word-break:break-word;max-height:320px;font:inherit;color:var(--dsw-alias-label-secondary);border-top:.5px solid var(--dsw-alias-border-l4);margin:0;padding:8px 10px 10px;font-size:12px;line-height:18px;overflow:auto}.rp_DmG_oG_entryOff .rp_DmG_oG_entryTitle{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}.rp_DmG_oG_choice{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);cursor:pointer;align-items:flex-start;gap:10px;padding:8px 10px;display:flex}@media (width<=640px){.rp_DmG_oG_body{padding-inline:16px}.rp_DmG_oG_top{flex-direction:column}.rp_DmG_oG_picture{width:96px;height:128px}.rp_DmG_oG_row{flex-wrap:wrap}}.rp_DmG_oG_choice input{margin-top:3px}.rp_DmG_oG_choiceText{flex-direction:column;gap:4px;min-width:0;display:flex}.rp_DmG_oG_preview{white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}";
10008
+ const key$6 = "src/client/pages/worlds/ImportCardPage.module.css";
10009
+ let tag$6 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$6) + "]");
10010
+ if (tag$6 === null) {
10011
+ tag$6 = document.createElement("style");
10012
+ tag$6.dataset.plugin = "@dsh-agentic-roleplay/core";
10013
+ tag$6.dataset.pluginCss = key$6;
10014
+ document.head.appendChild(tag$6);
8796
10015
  }
8797
- tag$5.textContent = css$5;
10016
+ tag$6.textContent = css$6;
8798
10017
  var ImportCardPage_module_css_default = {
8799
- "field": "rp_DmG_oG_field",
8800
- "choiceText": "rp_DmG_oG_choiceText",
8801
- "entryTitle": "rp_DmG_oG_entryTitle",
8802
- "note": "rp_DmG_oG_note",
8803
- "title": "rp_DmG_oG_title",
8804
- "space": "rp_DmG_oG_space",
8805
- "tags": "rp_DmG_oG_tags",
8806
- "row": "rp_DmG_oG_row",
8807
- "fieldMeta": "rp_DmG_oG_fieldMeta",
8808
- "fieldTitle": "rp_DmG_oG_fieldTitle",
8809
- "page": "rp_DmG_oG_page",
8810
- "fieldHead": "rp_DmG_oG_fieldHead",
8811
10018
  "top": "rp_DmG_oG_top",
8812
- "heading": "rp_DmG_oG_heading",
10019
+ "fieldTitle": "rp_DmG_oG_fieldTitle",
8813
10020
  "text": "rp_DmG_oG_text",
8814
- "section": "rp_DmG_oG_section",
8815
- "entry": "rp_DmG_oG_entry",
8816
- "header": "rp_DmG_oG_header",
10021
+ "entryOff": "rp_DmG_oG_entryOff",
8817
10022
  "picture": "rp_DmG_oG_picture",
10023
+ "heading": "rp_DmG_oG_heading",
10024
+ "about": "rp_DmG_oG_about",
10025
+ "title": "rp_DmG_oG_title",
10026
+ "tags": "rp_DmG_oG_tags",
10027
+ "page": "rp_DmG_oG_page",
10028
+ "note": "rp_DmG_oG_note",
8818
10029
  "entryHead": "rp_DmG_oG_entryHead",
8819
- "entryOff": "rp_DmG_oG_entryOff",
8820
10030
  "body": "rp_DmG_oG_body",
10031
+ "section": "rp_DmG_oG_section",
10032
+ "entryTitle": "rp_DmG_oG_entryTitle",
10033
+ "fieldMeta": "rp_DmG_oG_fieldMeta",
10034
+ "choiceText": "rp_DmG_oG_choiceText",
10035
+ "preview": "rp_DmG_oG_preview",
8821
10036
  "noPicture": "rp_DmG_oG_noPicture",
8822
- "choice": "rp_DmG_oG_choice",
8823
10037
  "error": "rp_DmG_oG_error",
10038
+ "space": "rp_DmG_oG_space",
10039
+ "entry": "rp_DmG_oG_entry",
10040
+ "header": "rp_DmG_oG_header",
8824
10041
  "label": "rp_DmG_oG_label",
8825
- "about": "rp_DmG_oG_about",
8826
- "preview": "rp_DmG_oG_preview"
10042
+ "row": "rp_DmG_oG_row",
10043
+ "fieldHead": "rp_DmG_oG_fieldHead",
10044
+ "choice": "rp_DmG_oG_choice",
10045
+ "field": "rp_DmG_oG_field"
8827
10046
  };
8828
10047
  //#endregion
8829
10048
  //#region src/client/pages/worlds/ImportCardPage.tsx
@@ -8954,7 +10173,9 @@ window.__ModuleLoader__.load({
8954
10173
  children: [preview.hasAvatar ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8955
10174
  className: ImportCardPage_module_css_default.picture,
8956
10175
  src: pictureUrl(preview.id),
8957
- alt: ""
10176
+ alt: "",
10177
+ loading: "lazy",
10178
+ decoding: "async"
8958
10179
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8959
10180
  className: `${ImportCardPage_module_css_default.picture} ${ImportCardPage_module_css_default.noPicture}`,
8960
10181
  children: t("importNoPicture")
@@ -9374,6 +10595,7 @@ window.__ModuleLoader__.load({
9374
10595
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorldCard, {
9375
10596
  world,
9376
10597
  playLabel: t("play"),
10598
+ openLabel: t("openWorld", { name: world.name }),
9377
10599
  onPlay: () => {
9378
10600
  openStartDialog(world.id, world.name);
9379
10601
  },
@@ -9436,7 +10658,7 @@ window.__ModuleLoader__.load({
9436
10658
  }
9437
10659
  //#endregion
9438
10660
  //#region src/client/settings-form/locales.ts
9439
- const dictionaries$5 = {
10661
+ const dictionaries$6 = {
9440
10662
  en: {
9441
10663
  samplingMaster: "Temperature: game master",
9442
10664
  samplingMasterHelp: "How freely the game master decides and narrates (0 to 2). Lower keeps its calls and the world consistent.",
@@ -9458,6 +10680,10 @@ window.__ModuleLoader__.load({
9458
10680
  recallHelp: "The most memories brought back to a character each time it acts, chosen by what the moment calls to mind.",
9459
10681
  overRetrieve: "Memories considered per memory recalled",
9460
10682
  overRetrieveHelp: "To choose what a character is reminded of, this many times as many candidates are retrieved (by the moment's cues, by words and by meaning) and the best are kept; a reranking service, when one is configured, judges the wider net. 1 chooses straight from the first search.",
10683
+ associate: "Memories that come to mind with others",
10684
+ associateHelp: "The most extra memories a character is reminded of because they are strongly tied (the same people together with the same place or tags) to something the moment called to mind, and matter enough. 0 turns it off.",
10685
+ diversity: "Spread of what is recalled",
10686
+ diversityHelp: "From 0 to 1: how much a memory that says what one already chosen says counts against it, so that a character is not reminded of the same moment several times. 0 chooses by score alone.",
9461
10687
  lookup: "Characters can look up memories",
9462
10688
  lookupHelp: "While it decides, a character can ask itself about something it remembers beyond what the moment already brought to mind. Each character only reaches its own memories. It makes a character's turn a little longer.",
9463
10689
  lookupCalls: "Memory look-ups per decision",
@@ -9514,6 +10740,22 @@ window.__ModuleLoader__.load({
9514
10740
  factionsPerTurnHelp: "The most organisations that decide what they do after one of your messages, when story time has passed since they last did. Each is one request in the background. 0 turns it off.",
9515
10741
  factionsEveryDays: "Days between their decisions",
9516
10742
  factionsEveryDaysHelp: "How many days of story time pass before an organisation decides again.",
10743
+ reflectionAuto: "Reflect on its own",
10744
+ reflectionAutoHelp: "Now and then the characters sort what they have taken in into what they believe: beliefs are merged, firmed up or let go, each only from events it can name. One request per character in the background. A reflection can always be started by hand from the chat settings.",
10745
+ reflectionEveryTurns: "Reflect every … turns",
10746
+ reflectionEveryTurnsHelp: "Reflect once this many of your messages have passed since the last reflection. 0 turns this off.",
10747
+ reflectionOnScene: "Reflect when the scene changes",
10748
+ reflectionOnSceneHelp: "Also reflect when your character has gone somewhere else, or a night has passed (see the next setting), once the minimum number of turns has gone by.",
10749
+ reflectionSceneDays: "Days that count as a change of scene",
10750
+ reflectionSceneDaysHelp: "How many days of story time since the last reflection count as a change of scene. 0 turns this off.",
10751
+ reflectionMinTurns: "Fewest turns between reflections",
10752
+ reflectionMinTurnsHelp: "However it is triggered, an automatic reflection waits until this many turns have passed since the last one.",
10753
+ reflectionPerRun: "Characters per reflection",
10754
+ reflectionPerRunHelp: "The most characters one automatic reflection takes up, those with the most new to sort first. Each is one request.",
10755
+ reflectionMinNew: "New memories needed",
10756
+ reflectionMinNewHelp: "A character is taken up only when this many things it took in are waiting. A reflection started by hand takes up one.",
10757
+ modelsBackground: "Model for background characters",
10758
+ modelsBackgroundHelp: "As provider/model. Characters of the background tier (crowds, passers-by) run on this model; empty uses the model for characters. They take part in the same way as the others, only on a cheaper model.",
9517
10759
  modelsCharacters: "Model for characters",
9518
10760
  modelsCharactersHelp: "As provider/model. Leave empty to use the chat's own model. Characters run side by side and write short answers, so a smaller, faster model often does as well.",
9519
10761
  modelsRecords: "Model for the record keeper",
@@ -9533,6 +10775,10 @@ window.__ModuleLoader__.load({
9533
10775
  offstagePerTurn: "Characters acting off stage per turn",
9534
10776
  offstagePerCharacter: "Times one character acts off stage per turn",
9535
10777
  offstagePerCharacterHelp: "A character with several things due is asked about the first; the rest wait for your next turn. With the limit above, this caps what the world does without you: nothing runs while you are away from the chat, and each message you send lets at most this many characters act.",
10778
+ interfacePack: "Interface pack",
10779
+ interfacePackHelp: "The interface pack this story uses. Empty uses the first pack the story carries; \"none\" turns packs off and shows the plain chat; a name picks that pack of the story, or of your roleplay folder's ui folder.",
10780
+ diagnosticsKeepRuns: "Keep what the helpers were told",
10781
+ diagnosticsKeepRunsHelp: "Each helper run (a character, the record keeper, the suggestions) keeps its instructions, what it was asked, its tool calls and its result, for the latest 60 runs. Open a run in the activity list to see why it said or wrote what it did. The texts include what the characters know in private, so leave it off unless you are looking for a problem.",
9536
10782
  offstageJoint: "Meetings happen between people",
9537
10783
  offstageJointHelp: "The people of one off-stage commitment decide one after another, each told who has already meant to come, so they meet instead of each guessing. It takes longer in the background but asks the same number of times. Off: each decides alone, all at once.",
9538
10784
  offstageSummary: "Tell me what happened meanwhile",
@@ -9581,6 +10827,10 @@ window.__ModuleLoader__.load({
9581
10827
  recallHelp: "角色每次行动时最多被唤起的记忆条数,按当前情境联想到的内容挑选。",
9582
10828
  overRetrieve: "每条回忆的候选倍数",
9583
10829
  overRetrieveHelp: "为了选出角色被唤起的记忆,会先检索出此倍数的候选(按情境线索、字词和语义),再保留最好的;若已配置重排序服务,则由它评判这张更大的网。1 表示直接从第一次检索中选取。",
10830
+ diversity: "回忆的分散程度",
10831
+ diversityHelp: "0 到 1:与已选中的某条记忆说的是同一件事的记忆要被扣多少分,这样角色就不会把同一个时刻想起好几遍。0 表示只按得分选择。",
10832
+ associate: "顺带想起的记忆",
10833
+ associateHelp: "角色会因为与当前情境唤起的某件事紧密相连(相同的人物,加上相同的地点或标签)且足够重要,而顺带想起的额外记忆的最大条数。0 表示关闭。",
9584
10834
  lookup: "角色可主动回忆",
9585
10835
  lookupHelp: "角色在决定行动时,可以主动向自己追问更多记忆,超出当前情境已唤起的部分。每个角色只能查到自己的记忆。会让角色的回合稍长一些。",
9586
10836
  lookupCalls: "每次决定的记忆查询次数",
@@ -9637,6 +10887,22 @@ window.__ModuleLoader__.load({
9637
10887
  factionsPerTurnHelp: "你发送一条消息后,最多让多少个组织决定自己的行动(前提是自它们上次行动以来故事时间已经过去)。每个组织占用一次后台请求。0 表示关闭。",
9638
10888
  factionsEveryDays: "决策间隔天数",
9639
10889
  factionsEveryDaysHelp: "组织再次决策之前要经过多少天故事时间。",
10890
+ reflectionAuto: "自动反思",
10891
+ reflectionAutoHelp: "角色们会时不时把近期的见闻整理成自己的信念:合并、巩固或放下旧信念,且每一条都必须能指出依据的事件。每个角色占用一次后台请求。你也可以随时在对话设置里手动开始一次反思。",
10892
+ reflectionEveryTurns: "每隔多少回合反思",
10893
+ reflectionEveryTurnsHelp: "自上次反思以来过了这么多条你的消息就反思一次。0 表示关闭。",
10894
+ reflectionOnScene: "场景转换时反思",
10895
+ reflectionOnSceneHelp: "当你的角色去了别处,或经过了一夜(见下一项)时也反思,但要先满足最少回合数。",
10896
+ reflectionSceneDays: "算作场景转换的天数",
10897
+ reflectionSceneDaysHelp: "自上次反思以来故事时间过去多少天算作场景转换。0 表示关闭。",
10898
+ reflectionMinTurns: "两次反思之间的最少回合数",
10899
+ reflectionMinTurnsHelp: "无论由什么触发,自动反思都要等到距上一次至少过了这么多回合。",
10900
+ reflectionPerRun: "每次反思的角色数",
10901
+ reflectionPerRunHelp: "一次自动反思最多处理多少个角色,新见闻最多的先处理。每个角色一次请求。",
10902
+ reflectionMinNew: "所需新记忆数",
10903
+ reflectionMinNewHelp: "只有角色积攒了这么多新的见闻才会被处理。手动开始的反思只需要一条。",
10904
+ modelsBackground: "背景角色使用的模型",
10905
+ modelsBackgroundHelp: "写成 提供方/模型。背景层级的角色(人群、路人)使用此模型;留空则使用“角色使用的模型”。它们的参与方式与其他角色相同,只是换成更便宜的模型。",
9640
10906
  modelsCharacters: "角色使用的模型",
9641
10907
  modelsCharactersHelp: "写成 提供方/模型。留空则使用对话自己的模型。角色并行运行且回答简短,较小较快的模型通常也能胜任。",
9642
10908
  modelsRecords: "记录员使用的模型",
@@ -9656,6 +10922,10 @@ window.__ModuleLoader__.load({
9656
10922
  offstagePerTurn: "每轮台下行动的角色数",
9657
10923
  offstagePerCharacter: "每个角色每轮台下行动次数",
9658
10924
  offstagePerCharacterHelp: "同一角色有多件事到期时,只询问第一件,其余等你的下一轮。配合上面的上限,这限制了世界在无人操作时的行动:你离开聊天时什么都不会运行,你每发一条消息最多让这么多次角色行动。",
10925
+ interfacePack: "界面包",
10926
+ interfacePackHelp: "此故事使用的界面包。留空则使用故事自带的第一个包;填 \"none\" 则关闭界面包并显示普通聊天;填名称则选用故事中的该包,或角色扮演目录 ui 文件夹中的该包。",
10927
+ diagnosticsKeepRuns: "保留助手收到的内容",
10928
+ diagnosticsKeepRunsHelp: "每次助手运行(角色、记录员、建议)都会保存它的指令、被问的内容、工具调用和结果,保留最近 60 次。在活动列表中打开一次运行,可查看它为何那样说或写。内容包含角色私下所知的信息,因此除非要排查问题,请保持关闭。",
9659
10929
  offstageJoint: "约定在人与人之间发生",
9660
10930
  offstageJointHelp: "同一个台下约定的人依次决定,后者会被告知谁已决定前来,因此他们会碰面而不是各自猜测。后台耗时更长,但请求次数不变。关闭则各自同时独立决定。",
9661
10931
  offstageSummary: "告诉我期间发生了什么",
@@ -9684,7 +10954,7 @@ window.__ModuleLoader__.load({
9684
10954
  embeddingOptionsHelp: "所选嵌入提供方允许本对话为每次请求设置的内容。留空则使用提供方自己的设置。"
9685
10955
  }
9686
10956
  };
9687
- const dictionaries$4 = withDictionaries(withDictionaries({
10957
+ const dictionaries$5 = withDictionaries(withDictionaries({
9688
10958
  en: {
9689
10959
  nav: "Worlds",
9690
10960
  loading: "Loading worlds…",
@@ -9702,6 +10972,7 @@ window.__ModuleLoader__.load({
9702
10972
  pageOf: "Page {page} of {pages}",
9703
10973
  problems: "{count} problem(s) found while reading worlds",
9704
10974
  play: "Start a new session",
10975
+ openWorld: "Edit {name}",
9705
10976
  worldMissing: "This world is no longer there.",
9706
10977
  importCard: "Import card",
9707
10978
  importUploading: "Reading the card…",
@@ -9797,6 +11068,7 @@ window.__ModuleLoader__.load({
9797
11068
  pageOf: "第 {page} 页,共 {pages} 页",
9798
11069
  problems: "读取世界卡时发现 {count} 个问题",
9799
11070
  play: "开始新存档",
11071
+ openWorld: "编辑{name}",
9800
11072
  worldMissing: "这个世界已经不存在了。",
9801
11073
  importCard: "导入角色卡",
9802
11074
  importUploading: "正在读取角色卡…",
@@ -9875,7 +11147,7 @@ window.__ModuleLoader__.load({
9875
11147
  startAvatars: "带上角色形象",
9876
11148
  startAvatarsHelp: "勾选要带进这个存档的角色形象,它们会成为存档中的角色,你也可以扮演它们。世界本身不会改变。"
9877
11149
  }
9878
- }, dictionaries$5), dictionaries$8);
11150
+ }, dictionaries$6), dictionaries$9);
9879
11151
  //#endregion
9880
11152
  //#region src/client/pages/worlds/worlds-controller.ts
9881
11153
  async function request$1(path, init, signal) {
@@ -10108,11 +11380,11 @@ window.__ModuleLoader__.load({
10108
11380
  };
10109
11381
  //#endregion
10110
11382
  //#region src/client/pages/worlds/index.ts
10111
- const NAMESPACE$6 = "roleplay.worlds";
11383
+ const NAMESPACE$7 = "roleplay.worlds";
10112
11384
  /** Adds the Worlds page to the Role Play panel. */
10113
11385
  function registerWorldsPage(ctx) {
10114
- const t = ctx.locale.bind(NAMESPACE$6);
10115
- ctx.effect(() => ctx.locale.register(NAMESPACE$6, dictionaries$4), "roleplay: worlds dictionaries");
11386
+ const t = ctx.locale.bind(NAMESPACE$7);
11387
+ ctx.effect(() => ctx.locale.register(NAMESPACE$7, dictionaries$5), "roleplay: worlds dictionaries");
10116
11388
  const worlds = new WorldsController(createChatOpener(ctx), () => t("language"));
10117
11389
  ctx.effect(() => () => {
10118
11390
  worlds.dispose();
@@ -10122,7 +11394,7 @@ window.__ModuleLoader__.load({
10122
11394
  id: "worlds",
10123
11395
  order: 0,
10124
11396
  label: () => t("nav"),
10125
- locale: NAMESPACE$6,
11397
+ locale: NAMESPACE$7,
10126
11398
  inject: () => worlds.inject()
10127
11399
  }, WorldsPage));
10128
11400
  }
@@ -10222,21 +11494,21 @@ window.__ModuleLoader__.load({
10222
11494
  };
10223
11495
  //#endregion
10224
11496
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/branch/BranchDialog.module.css.mjs
10225
- const css$4 = ".rp_Dy1TaW_form{flex-direction:column;gap:12px;min-width:min(420px,100%);display:flex}.rp_Dy1TaW_field{flex-direction:column;gap:6px;min-width:0;display:flex}.rp_Dy1TaW_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_Dy1TaW_error{color:var(--dsw-alias-state-danger-primary);margin:0;font-size:12px}";
10226
- const key$4 = "src/client/branch/BranchDialog.module.css";
10227
- let tag$4 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$4) + "]");
10228
- if (tag$4 === null) {
10229
- tag$4 = document.createElement("style");
10230
- tag$4.dataset.plugin = "@dsh-agentic-roleplay/core";
10231
- tag$4.dataset.pluginCss = key$4;
10232
- document.head.appendChild(tag$4);
11497
+ const css$5 = ".rp_Dy1TaW_form{flex-direction:column;gap:12px;min-width:min(420px,100%);display:flex}.rp_Dy1TaW_field{flex-direction:column;gap:6px;min-width:0;display:flex}.rp_Dy1TaW_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_Dy1TaW_error{color:var(--dsw-alias-state-danger-primary);margin:0;font-size:12px}";
11498
+ const key$5 = "src/client/branch/BranchDialog.module.css";
11499
+ let tag$5 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$5) + "]");
11500
+ if (tag$5 === null) {
11501
+ tag$5 = document.createElement("style");
11502
+ tag$5.dataset.plugin = "@dsh-agentic-roleplay/core";
11503
+ tag$5.dataset.pluginCss = key$5;
11504
+ document.head.appendChild(tag$5);
10233
11505
  }
10234
- tag$4.textContent = css$4;
11506
+ tag$5.textContent = css$5;
10235
11507
  var BranchDialog_module_css_default = {
10236
- "label": "rp_Dy1TaW_label",
10237
- "field": "rp_Dy1TaW_field",
10238
11508
  "form": "rp_Dy1TaW_form",
10239
- "error": "rp_Dy1TaW_error"
11509
+ "error": "rp_Dy1TaW_error",
11510
+ "label": "rp_Dy1TaW_label",
11511
+ "field": "rp_Dy1TaW_field"
10240
11512
  };
10241
11513
  //#endregion
10242
11514
  //#region src/client/branch/BranchDialog.tsx
@@ -10305,7 +11577,7 @@ window.__ModuleLoader__.load({
10305
11577
  }
10306
11578
  //#endregion
10307
11579
  //#region src/client/branch/locales.ts
10308
- const dictionaries$3 = {
11580
+ const dictionaries$4 = {
10309
11581
  en: {
10310
11582
  title: "Name the branch",
10311
11583
  description: "A new session was made from the story at this point; the first one is as it was.",
@@ -10329,10 +11601,10 @@ window.__ModuleLoader__.load({
10329
11601
  };
10330
11602
  //#endregion
10331
11603
  //#region src/client/branch/index.ts
10332
- const NAMESPACE$5 = "roleplay.branch";
11604
+ const NAMESPACE$6 = "roleplay.branch";
10333
11605
  /** Asks for a name when DSH's fork of a roleplay chat has made a session of its own. Forks of ordinary chats are not touched. */
10334
11606
  function registerBranchNaming(ctx) {
10335
- ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$3), "roleplay: branch dictionaries");
11607
+ ctx.effect(() => ctx.locale.register(NAMESPACE$6, dictionaries$4), "roleplay: branch dictionaries");
10336
11608
  const branches = new BranchController();
10337
11609
  ctx.inject(["sessions"], (inner) => {
10338
11610
  const sessions = inner.get("sessions");
@@ -10341,7 +11613,7 @@ window.__ModuleLoader__.load({
10341
11613
  ctx.slots.inject("shell.overlay", () => ctx.slots.register({
10342
11614
  name: "shell.overlay",
10343
11615
  id: "roleplay-branch",
10344
- locale: NAMESPACE$5,
11616
+ locale: NAMESPACE$6,
10345
11617
  inject: () => branches.inject()
10346
11618
  }, BranchDialog));
10347
11619
  }
@@ -10365,11 +11637,11 @@ window.__ModuleLoader__.load({
10365
11637
  }
10366
11638
  //#endregion
10367
11639
  //#region src/client/gallery/index.ts
10368
- const NAMESPACE$4 = "roleplay.gallery";
10369
- const VIEW_ID$2 = "roleplay-gallery";
11640
+ const NAMESPACE$5 = "roleplay.gallery";
11641
+ const VIEW_ID$3 = "roleplay-gallery";
10370
11642
  /** The shell activates a data target for every view tab; this tab reads from the host itself, so its target is empty. */
10371
11643
  const galleryTarget = {
10372
- target: VIEW_ID$2,
11644
+ target: VIEW_ID$3,
10373
11645
  create: () => ({
10374
11646
  empty: {},
10375
11647
  replace: () => ({}),
@@ -10378,94 +11650,647 @@ window.__ModuleLoader__.load({
10378
11650
  };
10379
11651
  /** Adds the Gallery tab beside Chat and World: every image of the session in a grid. */
10380
11652
  function registerGallery(ctx) {
10381
- const t = ctx.locale.bind(NAMESPACE$4);
10382
- ctx.effect(() => ctx.locale.register(NAMESPACE$4, dictionaries$9), "roleplay: gallery dictionaries");
11653
+ const t = ctx.locale.bind(NAMESPACE$5);
11654
+ ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$12), "roleplay: gallery dictionaries");
10383
11655
  ctx.inject(["uiConversation"], (scope) => {
10384
11656
  scope.uiConversation.views.register(galleryTarget);
10385
11657
  scope.slots.inject("conversation.view", () => scope.slots.register({
10386
11658
  name: "conversation.view",
10387
- id: VIEW_ID$2,
11659
+ id: VIEW_ID$3,
10388
11660
  order: 15,
10389
11661
  label: () => t("tab"),
10390
- locale: NAMESPACE$4
11662
+ locale: NAMESPACE$5
10391
11663
  }, GalleryTab));
10392
11664
  });
10393
11665
  }
10394
11666
  //#endregion
10395
- //#region src/shared/authoring-chat.ts
10396
- const PREFIX = "world-author-";
10397
- /** The authored world named by a dedicated authoring chat. */
10398
- function authoredWorldOf(chatSessionId) {
10399
- if (!chatSessionId.startsWith(PREFIX)) return void 0;
10400
- try {
10401
- const id = decodeURIComponent(chatSessionId.slice(13));
10402
- return id === "" ? void 0 : id;
10403
- } catch {
10404
- return;
10405
- }
10406
- }
10407
- //#endregion
10408
- //#region src/client/world/session-source.ts
10409
- /** The story of a roleplay session, as the World tab reads and edits it. */
10410
- function sessionSource(session) {
10411
- const id = encodeURIComponent(session);
11667
+ //#region src/client/chat-input.ts
11668
+ /** What can be done with the input box of a session: put words in it, and send them. Resolved on use, so a client without it fails at the click. */
11669
+ function facadeOf(scope, sessionId) {
11670
+ const input = () => {
11671
+ const actx = scope.get("sessions")?.scope(sessionId);
11672
+ const conversation = actx?.get("conversation");
11673
+ if (actx === void 0 || conversation === void 0) throw new Error("the input of this chat is not available");
11674
+ return conversation.input.for(actx);
11675
+ };
10412
11676
  return {
10413
- load: async (signal) => await answer$2(await fetch(`${API_PREFIX}/sessions/world?id=${id}`, {
10414
- credentials: "same-origin",
10415
- signal
10416
- })),
10417
- saveCharacter: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/character?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
10418
- savePlace: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/place?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
10419
- saveThing: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/thing?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
10420
- saveFaction: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/faction?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
10421
- saveLore: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/lore?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
10422
- savePlots: async (edit, signal) => await put(`${API_PREFIX}/sessions/world/plots?id=${id}`, edit, signal),
10423
- saveRelation: async (edit, signal) => await put(`${API_PREFIX}/sessions/world/relation?id=${id}`, edit, signal),
10424
- saveNarrationVoice: async (voice, signal) => await put(`${API_PREFIX}/sessions/world/narration-voice?id=${id}`, { voice }, signal),
10425
- listVoices: async (signal) => await listVoices(`${API_PREFIX}/speech/voices`, signal),
10426
- generatePortrait: async (key, signal) => await post(`${API_PREFIX}/sessions/world/character/portrait?id=${id}&key=${encodeURIComponent(key)}`, signal),
10427
- uploadPortrait: async (key, file, signal) => await postFile(`${API_PREFIX}/sessions/world/character/portrait/upload?id=${id}&key=${encodeURIComponent(key)}`, file, signal)
11677
+ pick: (text) => {
11678
+ input().setDraft(text);
11679
+ },
11680
+ fill: (text, send) => {
11681
+ const facade = input();
11682
+ facade.setDraft(text);
11683
+ if (send) facade.submit();
11684
+ }
10428
11685
  };
10429
11686
  }
10430
11687
  //#endregion
10431
- //#region src/client/world/WorldTab.tsx
10432
- /** The story of the current chat, to read and to author. Ordinary DSH chats have ids of the same shape, so the host decides whether this one is a roleplay session. */
10433
- function WorldTab({ t, sessionId }) {
10434
- const session = roleplaySessionOf(sessionId);
10435
- const world = authoredWorldOf(sessionId);
10436
- const source = (0, react.useMemo)(() => session !== void 0 ? sessionSource(session) : world !== void 0 ? worldSource(world) : void 0, [session, world]);
10437
- if (source === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10438
- style: {
10439
- padding: 24,
10440
- fontSize: 13
10441
- },
10442
- children: t("notRoleplay")
10443
- });
10444
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorldEditor, {
10445
- t,
10446
- source,
10447
- notEditable: t("notRoleplay")
10448
- });
11688
+ //#region src/client/interface/api.ts
11689
+ /** The host says why in `message`; a failure that has none is told by its status. */
11690
+ async function read(response, what) {
11691
+ if (!response.ok) throw new Error((await response.json().catch(() => ({}))).message ?? `${what} (${response.status})`);
11692
+ return await response.json();
11693
+ }
11694
+ const enc = encodeURIComponent;
11695
+ async function packOf(session) {
11696
+ return read(await fetch(`roleplay-api/sessions/interface?id=${enc(session)}`), "the interface pack could not be read");
11697
+ }
11698
+ async function viewOf(session, revision) {
11699
+ return read(await fetch(`roleplay-api/sessions/interface/view?id=${enc(session)}${revision === void 0 ? "" : `&revision=${enc(revision)}`}`), "the story could not be read");
11700
+ }
11701
+ async function availability() {
11702
+ return read(await fetch("roleplay-api/interface/availability"), "the interface packs could not be looked up");
10449
11703
  }
10450
11704
  //#endregion
10451
- //#region src/client/world/index.ts
10452
- const NAMESPACE$3 = "roleplay.world";
10453
- const VIEW_ID$1 = "roleplay-world";
10454
- /** The shell activates a data target for every view tab; this tab reads from the host itself, so its target is empty. */
10455
- const worldTarget = {
10456
- target: VIEW_ID$1,
10457
- create: () => ({
10458
- empty: {},
10459
- replace: () => ({}),
10460
- apply: () => ({})
10461
- })
10462
- };
10463
- /** Adds the World tab beside Chat: the state of the story, by the part of the world. */
10464
- function registerWorld(ctx) {
10465
- const t = ctx.locale.bind(NAMESPACE$3);
10466
- ctx.effect(() => ctx.locale.register(NAMESPACE$3, dictionaries$8), "roleplay: world dictionaries");
10467
- ctx.inject(["uiConversation"], (scope) => {
10468
- scope.uiConversation.views.register(worldTarget);
11705
+ //#region src/client/interface/conversation-body.ts
11706
+ /** How the conversation's scrolling body is found: DSH's class name ends in this, with a prefix of its build's own. */
11707
+ const SCROLL_BODY = "_scrollBody";
11708
+ /**
11709
+ * The element that holds a session's transcript and what is drawn behind it, found from something inside the same
11710
+ * conversation: the closest ancestor that contains the scrolling body of the chat, and that body's parent.
11711
+ */
11712
+ function conversationBody(from) {
11713
+ for (let at = from.parentElement; at !== null; at = at.parentElement) {
11714
+ const scroll = at.querySelector(`[class*="${SCROLL_BODY}"]`);
11715
+ if (scroll?.parentElement != null) return {
11716
+ body: scroll.parentElement,
11717
+ scroll
11718
+ };
11719
+ }
11720
+ }
11721
+ //#endregion
11722
+ //#region src/client/interface/backdrop.ts
11723
+ const LIFTED = "data-rp-lifted";
11724
+ const STYLE = "data-roleplay-backdrop-style";
11725
+ /**
11726
+ * A layer behind the transcript of the chat that `anchor` stands in, for a pack's backdrop. The conversation paints its
11727
+ * own opaque background and its scrolling body above any layer under it, so the layer is put first in the body and the
11728
+ * scrolling body is lifted over it; both stay transparent to clicks. When the page is not built as expected there is
11729
+ * no layer and a note in the console, and the story plays as it does without a backdrop.
11730
+ */
11731
+ function useBackdropHost(anchor, enabled) {
11732
+ const [host, setHost] = (0, react.useState)(void 0);
11733
+ (0, react.useEffect)(() => {
11734
+ const from = anchor.current;
11735
+ if (!enabled || from === null) {
11736
+ setHost(void 0);
11737
+ return;
11738
+ }
11739
+ const found = conversationBody(from);
11740
+ if (found === void 0) {
11741
+ console.warn("roleplay: the interface pack has a backdrop, but this page has no place for one");
11742
+ setHost(void 0);
11743
+ return;
11744
+ }
11745
+ const layer = document.createElement("div");
11746
+ layer.setAttribute("data-rp", "backdrop");
11747
+ layer.style.cssText = "position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden";
11748
+ found.body.insertBefore(layer, found.body.firstChild);
11749
+ found.scroll.setAttribute(LIFTED, "");
11750
+ let style = document.head.querySelector(`style[${STYLE}]`);
11751
+ if (style === null) {
11752
+ style = document.createElement("style");
11753
+ style.setAttribute(STYLE, "");
11754
+ style.textContent = `[${LIFTED}]{position:relative;z-index:1}`;
11755
+ document.head.append(style);
11756
+ }
11757
+ setHost(layer);
11758
+ return () => {
11759
+ layer.remove();
11760
+ found.scroll.removeAttribute(LIFTED);
11761
+ if (document.querySelector(`[${LIFTED}]`) === null) document.head.querySelector(`style[${STYLE}]`)?.remove();
11762
+ setHost(void 0);
11763
+ };
11764
+ }, [anchor, enabled]);
11765
+ return host;
11766
+ }
11767
+ //#endregion
11768
+ //#region src/client/interface/hooks.ts
11769
+ const PACK_POLL_MS = 4e3;
11770
+ const VIEW_POLL_MS = 2e3;
11771
+ /**
11772
+ * One poll of the host for everyone who wants the same thing: the strips, the tab and the backdrop of a story all
11773
+ * read the same pack and view, so they share the request instead of each making their own.
11774
+ */
11775
+ function useShared(cache, key, active, fetch, onError, interval) {
11776
+ const [value, setValue] = (0, react.useState)(key === void 0 ? void 0 : cache.get(key)?.value);
11777
+ (0, react.useEffect)(() => {
11778
+ if (key === void 0 || !active) {
11779
+ setValue(void 0);
11780
+ return;
11781
+ }
11782
+ let entry = cache.get(key);
11783
+ if (entry === void 0) {
11784
+ const created = {
11785
+ listeners: /* @__PURE__ */ new Set(),
11786
+ value: void 0,
11787
+ stop: () => void 0
11788
+ };
11789
+ entry = created;
11790
+ cache.set(key, created);
11791
+ let stopped = false;
11792
+ let timer;
11793
+ const look = () => {
11794
+ fetch(created.value).then((next) => {
11795
+ created.value = next;
11796
+ }, (error) => {
11797
+ created.value = onError(error);
11798
+ }).finally(() => {
11799
+ if (stopped) return;
11800
+ for (const listener of created.listeners) listener(created.value);
11801
+ timer = setTimeout(look, interval);
11802
+ });
11803
+ };
11804
+ created.stop = () => {
11805
+ stopped = true;
11806
+ if (timer !== void 0) clearTimeout(timer);
11807
+ };
11808
+ look();
11809
+ }
11810
+ const listener = (next) => {
11811
+ setValue((previous) => previous === next ? previous : next);
11812
+ };
11813
+ entry.listeners.add(listener);
11814
+ setValue(entry.value);
11815
+ return () => {
11816
+ entry.listeners.delete(listener);
11817
+ if (entry.listeners.size === 0) {
11818
+ entry.stop();
11819
+ cache.delete(key);
11820
+ }
11821
+ };
11822
+ }, [
11823
+ cache,
11824
+ key,
11825
+ active,
11826
+ interval
11827
+ ]);
11828
+ return value;
11829
+ }
11830
+ const packs = /* @__PURE__ */ new Map();
11831
+ const views = /* @__PURE__ */ new Map();
11832
+ /** The interface pack of a story, looked at again from time to time so that an edited file shows. A session the host does not know has none. */
11833
+ function usePack(session) {
11834
+ return useShared(packs, session, true, async (previous) => {
11835
+ const found = await packOf(session);
11836
+ return previous !== void 0 && JSON.stringify(previous) === JSON.stringify(found) ? previous : found;
11837
+ }, () => ({
11838
+ pack: null,
11839
+ problems: []
11840
+ }), PACK_POLL_MS);
11841
+ }
11842
+ /** What the player may know of the story, kept up to date while `active`. */
11843
+ function usePlayerView(session, active) {
11844
+ return useShared(views, session, active, async (previous) => {
11845
+ const reply = await viewOf(session, previous?.revision);
11846
+ return reply.unchanged !== true && "view" in reply ? reply.view : previous;
11847
+ }, (error) => {
11848
+ console.warn("roleplay: the story could not be read for the interface pack", error);
11849
+ }, VIEW_POLL_MS);
11850
+ }
11851
+ //#endregion
11852
+ //#region src/client/interface/PackDock.tsx
11853
+ /**
11854
+ * A strip of the story's interface pack in the chat: `hud` above the input box and its docks, `dock` just above the
11855
+ * input, `opening` in the place of both until the first turn has been played. The `hud` one also puts the pack's
11856
+ * colours and skin into the page, so that they come with the pack even when it has no strip. Renders nothing for a
11857
+ * story without such a strip.
11858
+ */
11859
+ function PackDock({ sessionId, surface, frameInput, overrideTokens, useSession, t }) {
11860
+ const session = roleplaySessionOf(sessionId);
11861
+ const pack = usePack(session)?.pack ?? void 0;
11862
+ const strip = pack?.surfaces[surface];
11863
+ const backdrop = surface === "hud" ? pack?.surfaces.backdrop : void 0;
11864
+ const anchor = (0, react.useRef)(null);
11865
+ const layer = useBackdropHost(anchor, backdrop !== void 0);
11866
+ const running = useSession((state) => state.running);
11867
+ const view = usePlayerView(session, strip !== void 0 || backdrop !== void 0);
11868
+ const [height, setHeight] = (0, react.useState)(void 0);
11869
+ const resize = (0, react.useCallback)((next) => {
11870
+ setHeight(next);
11871
+ }, []);
11872
+ (0, react.useEffect)(() => {
11873
+ if (surface !== "hud" || pack === void 0 || pack.skin === "") return void 0;
11874
+ const style = document.createElement("style");
11875
+ style.setAttribute("data-roleplay-pack", pack.id);
11876
+ style.textContent = pack.skin;
11877
+ document.head.append(style);
11878
+ return () => {
11879
+ style.remove();
11880
+ };
11881
+ }, [
11882
+ surface,
11883
+ pack?.id,
11884
+ pack?.skin
11885
+ ]);
11886
+ const tokens = pack?.theme;
11887
+ (0, react.useEffect)(() => {
11888
+ if (surface !== "hud" || tokens === void 0 || Object.keys(tokens).length === 0) return void 0;
11889
+ return overrideTokens("roleplay-pack", tokens);
11890
+ }, [
11891
+ surface,
11892
+ tokens,
11893
+ overrideTokens
11894
+ ]);
11895
+ if (session === void 0 || pack === void 0) return null;
11896
+ const shown = strip !== void 0 && !(surface === "opening" && (running || view === void 0 || view.story.turn > 0));
11897
+ if (!shown && backdrop === void 0) return null;
11898
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
11899
+ shown && strip !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11900
+ className: PackFrame_module_css_default.hud,
11901
+ "data-rp": surface,
11902
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
11903
+ backend: sessionBackend(session),
11904
+ pack,
11905
+ surface,
11906
+ view,
11907
+ input: frameInput,
11908
+ onResize: resize,
11909
+ ...height === void 0 && strip.height === void 0 ? {} : { height: height ?? strip.height },
11910
+ title: t(surface)
11911
+ })
11912
+ }),
11913
+ backdrop !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11914
+ ref: anchor,
11915
+ hidden: true
11916
+ }),
11917
+ layer !== void 0 && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
11918
+ backend: sessionBackend(session),
11919
+ pack,
11920
+ surface: "backdrop",
11921
+ view,
11922
+ input: frameInput,
11923
+ fill: true,
11924
+ title: t("backdrop")
11925
+ }), layer)
11926
+ ] });
11927
+ }
11928
+ //#endregion
11929
+ //#region src/client/interface/InterfaceTab.tsx
11930
+ /** The tab of the story's interface pack: a page of its own beside Chat. */
11931
+ function InterfaceTab({ sessionId, frameInput, t }) {
11932
+ const session = roleplaySessionOf(sessionId);
11933
+ const payload = usePack(session);
11934
+ const pack = payload?.pack ?? void 0;
11935
+ const tab = pack?.surfaces.tab;
11936
+ const view = usePlayerView(session, tab !== void 0);
11937
+ if (session === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11938
+ className: PackFrame_module_css_default.message,
11939
+ children: t("notRoleplay")
11940
+ });
11941
+ if (payload === void 0) return null;
11942
+ if (pack === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11943
+ className: PackFrame_module_css_default.message,
11944
+ children: [payload.problems.length === 0 ? t("noPack") : t("problems"), payload.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
11945
+ className: PackFrame_module_css_default.problems,
11946
+ children: payload.problems.map((problem, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: problem.file === "" ? problem.message : `${problem.file}: ${problem.message}` }, index))
11947
+ })]
11948
+ });
11949
+ if (tab === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11950
+ className: PackFrame_module_css_default.message,
11951
+ children: t("noTab")
11952
+ });
11953
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11954
+ className: PackFrame_module_css_default.tab,
11955
+ "data-rp": "tab",
11956
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
11957
+ backend: sessionBackend(session),
11958
+ pack,
11959
+ surface: "tab",
11960
+ view,
11961
+ input: frameInput(sessionId),
11962
+ fill: true,
11963
+ title: tab.title === "" ? pack.name : tab.title
11964
+ })
11965
+ });
11966
+ }
11967
+ //#endregion
11968
+ //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/interface/SidebarPage.module.css.mjs
11969
+ const css$4 = ".rp_Ptco8a_page{flex-direction:column;width:100%;height:100%;min-height:0;display:flex}.rp_Ptco8a_bar{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:4px 8px;display:flex}.rp_Ptco8a_name{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.rp_Ptco8a_content{flex:1 1 0;min-height:0;position:relative}.rp_Ptco8a_message{color:var(--dsw-alias-label-secondary);margin:0;padding:16px;font-size:13px;line-height:20px}.rp_Ptco8a_entry{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsl-guide-entry-radius,var(--dsw-radius-sm));background:var(--dsw-alias-bg-layer-1);align-items:center;gap:14px;width:100%;min-height:56px;padding:14px 20px;display:flex;position:relative;overflow:hidden}.rp_Ptco8a_main{border-radius:0;width:100%;height:100%;position:absolute;inset:0}.rp_Ptco8a_icon{width:26px;height:26px;color:var(--dsw-alias-label-secondary);pointer-events:none;flex:none;justify-content:center;align-items:center;display:flex;position:relative}.rp_Ptco8a_text{pointer-events:none;flex-direction:column;flex:1;gap:3px;min-width:0;display:flex;position:relative}.rp_Ptco8a_title{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.4;overflow:hidden}.rp_Ptco8a_description{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;line-height:1.4;overflow:hidden}";
11970
+ const key$4 = "src/client/interface/SidebarPage.module.css";
11971
+ let tag$4 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$4) + "]");
11972
+ if (tag$4 === null) {
11973
+ tag$4 = document.createElement("style");
11974
+ tag$4.dataset.plugin = "@dsh-agentic-roleplay/core";
11975
+ tag$4.dataset.pluginCss = key$4;
11976
+ document.head.appendChild(tag$4);
11977
+ }
11978
+ tag$4.textContent = css$4;
11979
+ var SidebarPage_module_css_default = {
11980
+ "main": "rp_Ptco8a_main",
11981
+ "bar": "rp_Ptco8a_bar",
11982
+ "content": "rp_Ptco8a_content",
11983
+ "name": "rp_Ptco8a_name",
11984
+ "icon": "rp_Ptco8a_icon",
11985
+ "message": "rp_Ptco8a_message",
11986
+ "page": "rp_Ptco8a_page",
11987
+ "title": "rp_Ptco8a_title",
11988
+ "description": "rp_Ptco8a_description",
11989
+ "entry": "rp_Ptco8a_entry",
11990
+ "text": "rp_Ptco8a_text"
11991
+ };
11992
+ //#endregion
11993
+ //#region src/client/interface/SidebarPage.tsx
11994
+ /** The kind of the tab type, and the identity it registers its card and body under. */
11995
+ const SIDEBAR_KIND = "roleplay-pack";
11996
+ const SIDEBAR_ID = "@dsh-agentic-roleplay/core/interface-sidebar";
11997
+ /**
11998
+ * The entry of the guide page of the right sidebar that opens the pack's own page, drawn like the entries of DSH's own
11999
+ * pages. It is there only for a story whose pack has such a page, so an ordinary chat's guide is left as it was.
12000
+ */
12001
+ function SidebarGuide({ sessionId, useTabInfo, description, t }) {
12002
+ const pack = usePack(roleplaySessionOf(sessionId))?.pack ?? void 0;
12003
+ const page = pack?.surfaces.sidebar;
12004
+ const { tab } = useTabInfo();
12005
+ if (pack === void 0 || page === void 0) return null;
12006
+ const title = page.title === "" ? pack.name : page.title;
12007
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12008
+ className: SidebarPage_module_css_default.entry,
12009
+ "data-sidebar-right-guide-entry": SIDEBAR_KIND,
12010
+ children: [
12011
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
12012
+ variant: "ghost",
12013
+ className: SidebarPage_module_css_default.main,
12014
+ "aria-label": title,
12015
+ onClick: () => {
12016
+ tab.actions.openTab(SIDEBAR_KIND, { replaceTab: true });
12017
+ }
12018
+ }),
12019
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12020
+ className: SidebarPage_module_css_default.icon,
12021
+ "aria-hidden": "true",
12022
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGlobeOutlineRegular, { size: description === void 0 ? 22 : 26 })
12023
+ }),
12024
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12025
+ className: SidebarPage_module_css_default.text,
12026
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12027
+ className: SidebarPage_module_css_default.title,
12028
+ "aria-hidden": "true",
12029
+ children: title
12030
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12031
+ className: SidebarPage_module_css_default.description,
12032
+ "aria-hidden": "true",
12033
+ children: t("sidebarDescription")
12034
+ })]
12035
+ })
12036
+ ]
12037
+ });
12038
+ }
12039
+ /**
12040
+ * The body of the tab: a bar of ours with a way back to the guide, and under it the pack's page, which has the rest of
12041
+ * the sidebar to itself. The page is kept while the tab is hidden, so what it draws goes on between looks.
12042
+ */
12043
+ function SidebarBody({ sessionId, useTabInfo, frameInput, t }) {
12044
+ const session = roleplaySessionOf(sessionId);
12045
+ const { tab } = useTabInfo();
12046
+ const pack = usePack(session)?.pack ?? void 0;
12047
+ const page = pack?.surfaces.sidebar;
12048
+ const view = usePlayerView(session, tab.visible && page !== void 0);
12049
+ const back = () => {
12050
+ tab.actions.openTab("guide", { replaceTab: true });
12051
+ };
12052
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12053
+ className: SidebarPage_module_css_default.page,
12054
+ "data-rp": "sidebar",
12055
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12056
+ className: SidebarPage_module_css_default.bar,
12057
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
12058
+ variant: "ghost",
12059
+ size: "sm",
12060
+ onClick: back,
12061
+ children: ["← ", t("sidebarBack")]
12062
+ }), pack !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12063
+ className: SidebarPage_module_css_default.name,
12064
+ children: page?.title === void 0 || page.title === "" ? pack.name : page.title
12065
+ })]
12066
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12067
+ className: SidebarPage_module_css_default.content,
12068
+ children: session === void 0 || pack === void 0 || page === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12069
+ className: SidebarPage_module_css_default.message,
12070
+ children: t("sidebarNone")
12071
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
12072
+ backend: sessionBackend(session),
12073
+ pack,
12074
+ surface: "sidebar",
12075
+ view,
12076
+ input: frameInput,
12077
+ fill: true,
12078
+ title: page.title === "" ? pack.name : page.title
12079
+ })
12080
+ })]
12081
+ });
12082
+ }
12083
+ //#endregion
12084
+ //#region src/client/interface/locales.ts
12085
+ const dictionaries$3 = {
12086
+ en: {
12087
+ tab: "Interface",
12088
+ notRoleplay: "This chat is not a roleplay session.",
12089
+ noPack: "This story has no interface pack. A world can carry one in its ui folder, or you can put one in the ui folder of your roleplay folder and name it in the story's settings.",
12090
+ noTab: "The interface pack of this story has no tab.",
12091
+ problems: "The interface pack cannot be used:",
12092
+ hud: "Status",
12093
+ dock: "Actions",
12094
+ opening: "Opening",
12095
+ backdrop: "Backdrop",
12096
+ sidebar: "Sidebar page",
12097
+ sidebarTitle: "Interface page",
12098
+ sidebarDescription: "A page of this story's interface pack",
12099
+ sidebarBack: "Back",
12100
+ sidebarNone: "This story's interface pack has no page for the sidebar."
12101
+ },
12102
+ zh: {
12103
+ tab: "界面",
12104
+ notRoleplay: "此聊天不是角色扮演会话。",
12105
+ noPack: "此故事没有界面包。世界可以在其 ui 文件夹中携带界面包,也可以把界面包放进角色扮演目录的 ui 文件夹,并在故事设置中指定名称。",
12106
+ noTab: "此故事的界面包没有标签页。",
12107
+ problems: "无法使用界面包:",
12108
+ hud: "状态",
12109
+ dock: "操作",
12110
+ opening: "开场",
12111
+ backdrop: "背景",
12112
+ sidebar: "侧栏页面",
12113
+ sidebarTitle: "界面页面",
12114
+ sidebarDescription: "此故事界面包的一个页面",
12115
+ sidebarBack: "返回",
12116
+ sidebarNone: "此故事的界面包没有侧栏页面。"
12117
+ }
12118
+ };
12119
+ //#endregion
12120
+ //#region src/client/interface/index.ts
12121
+ const NAMESPACE$4 = "roleplay.interface";
12122
+ const VIEW_ID$2 = "roleplay-interface";
12123
+ /** The shell activates a data target for every view tab; the pack's tab reads from the host itself, so its target is empty. */
12124
+ const target = {
12125
+ target: VIEW_ID$2,
12126
+ create: () => ({
12127
+ empty: {},
12128
+ replace: () => ({}),
12129
+ apply: () => ({})
12130
+ })
12131
+ };
12132
+ /**
12133
+ * Interface packs: what a story's files add to the page. The status strip and the pack's colours and skin come with the
12134
+ * dock above the input box; the tab is offered only when some pack has one, which the host is asked when the page loads.
12135
+ */
12136
+ function registerInterface(ctx) {
12137
+ const t = ctx.locale.bind(NAMESPACE$4);
12138
+ ctx.effect(() => ctx.locale.register(NAMESPACE$4, dictionaries$3), "roleplay: interface dictionaries");
12139
+ ctx.inject(["uiConversation"], (scope) => {
12140
+ const input = (sessionId) => {
12141
+ const facade = facadeOf(scope, sessionId);
12142
+ return {
12143
+ say: (text) => {
12144
+ facade.fill(text, true);
12145
+ },
12146
+ fill: (text) => {
12147
+ facade.fill(text, false);
12148
+ },
12149
+ open: (surface) => {
12150
+ if (surface === "sidebar") scope.get("sidebarRight")?.openTab(SIDEBAR_KIND);
12151
+ else scope.uiConversation.binding(sessionId).activate(VIEW_ID$2);
12152
+ }
12153
+ };
12154
+ };
12155
+ const overrideTokens = (source, tokens) => scope.get("theme")?.overrideTokens(source, tokens) ?? (() => void 0);
12156
+ for (const [surface, order] of [
12157
+ ["opening", 1],
12158
+ ["hud", 3],
12159
+ ["dock", 20]
12160
+ ]) scope.slots.inject("conversation.input.dock", () => scope.slots.register({
12161
+ name: "conversation.input.dock",
12162
+ id: `roleplay-${surface}`,
12163
+ order,
12164
+ locale: NAMESPACE$4,
12165
+ inject: (sessionId) => ({
12166
+ surface,
12167
+ frameInput: input(sessionId),
12168
+ overrideTokens
12169
+ })
12170
+ }, PackDock));
12171
+ scope.inject(["sidebarRight", "sidebarRightTabs"], (right) => {
12172
+ right.effect(() => right.sidebarRightTabs.register({
12173
+ id: SIDEBAR_ID,
12174
+ kind: SIDEBAR_KIND,
12175
+ keepMounted: true,
12176
+ title: () => t("sidebarTitle"),
12177
+ guide: [{
12178
+ id: "page",
12179
+ order: 30,
12180
+ title: () => t("sidebarTitle"),
12181
+ description: () => t("sidebarDescription"),
12182
+ icon: _deepseek_ai_dsh_client_ui_primitives.IconGlobeOutlineRegular
12183
+ }]
12184
+ }), "roleplay: sidebar tab type");
12185
+ right.effect(() => right.slots.inject("sidebar.right.tab.guide.entry", () => right.slots.register({
12186
+ name: "sidebar.right.tab.guide.entry",
12187
+ key: SIDEBAR_ID,
12188
+ locale: NAMESPACE$4,
12189
+ inject: (sessionId) => ({ sessionId })
12190
+ }, SidebarGuide)), "roleplay: sidebar guide entry");
12191
+ right.effect(() => right.slots.inject("sidebar.right.pane.tab", () => right.slots.register({
12192
+ name: "sidebar.right.pane.tab",
12193
+ key: SIDEBAR_ID,
12194
+ locale: NAMESPACE$4,
12195
+ inject: (sessionId) => ({
12196
+ sessionId,
12197
+ frameInput: input(sessionId)
12198
+ })
12199
+ }, SidebarBody)), "roleplay: sidebar body");
12200
+ });
12201
+ let offered = false;
12202
+ availability().then((found) => {
12203
+ if (!found.tab || offered) return;
12204
+ offered = true;
12205
+ scope.uiConversation.views.register(target);
12206
+ scope.slots.inject("conversation.view", () => scope.slots.register({
12207
+ name: "conversation.view",
12208
+ id: VIEW_ID$2,
12209
+ order: 18,
12210
+ label: () => t("tab"),
12211
+ locale: NAMESPACE$4,
12212
+ inject: () => ({ frameInput: input })
12213
+ }, InterfaceTab));
12214
+ }).catch((error) => {
12215
+ console.warn("roleplay: the interface packs could not be looked up", error);
12216
+ });
12217
+ });
12218
+ }
12219
+ //#endregion
12220
+ //#region src/shared/authoring-chat.ts
12221
+ const PREFIX = "world-author-";
12222
+ /** The authored world named by a dedicated authoring chat. */
12223
+ function authoredWorldOf(chatSessionId) {
12224
+ if (!chatSessionId.startsWith(PREFIX)) return void 0;
12225
+ try {
12226
+ const id = decodeURIComponent(chatSessionId.slice(13));
12227
+ return id === "" ? void 0 : id;
12228
+ } catch {
12229
+ return;
12230
+ }
12231
+ }
12232
+ //#endregion
12233
+ //#region src/client/world/session-source.ts
12234
+ /** The story of a roleplay session, as the World tab reads and edits it. */
12235
+ function sessionSource(session) {
12236
+ const id = encodeURIComponent(session);
12237
+ return {
12238
+ load: async (signal) => await answer$2(await fetch(`${API_PREFIX}/sessions/world?id=${id}`, {
12239
+ credentials: "same-origin",
12240
+ signal
12241
+ })),
12242
+ saveCharacter: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/character?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
12243
+ savePlace: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/place?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
12244
+ saveThing: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/thing?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
12245
+ saveFaction: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/faction?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
12246
+ saveLore: async (key, edit, signal) => await put(`${API_PREFIX}/sessions/world/lore?id=${id}&key=${encodeURIComponent(key)}`, edit, signal),
12247
+ savePlots: async (edit, signal) => await put(`${API_PREFIX}/sessions/world/plots?id=${id}`, edit, signal),
12248
+ saveRelation: async (edit, signal) => await put(`${API_PREFIX}/sessions/world/relation?id=${id}`, edit, signal),
12249
+ saveNarrationVoice: async (voice, signal) => await put(`${API_PREFIX}/sessions/world/narration-voice?id=${id}`, { voice }, signal),
12250
+ listVoices: async (signal) => await listVoices(`${API_PREFIX}/speech/voices`, signal),
12251
+ generatePortrait: async (key, signal) => await post(`${API_PREFIX}/sessions/world/character/portrait?id=${id}&key=${encodeURIComponent(key)}`, signal),
12252
+ uploadPortrait: async (key, file, signal) => await postFile(`${API_PREFIX}/sessions/world/character/portrait/upload?id=${id}&key=${encodeURIComponent(key)}`, file, signal)
12253
+ };
12254
+ }
12255
+ //#endregion
12256
+ //#region src/client/world/WorldTab.tsx
12257
+ /** The story of the current chat, to read and to author. Ordinary DSH chats have ids of the same shape, so the host decides whether this one is a roleplay session. */
12258
+ function WorldTab({ t, sessionId }) {
12259
+ const session = roleplaySessionOf(sessionId);
12260
+ const world = authoredWorldOf(sessionId);
12261
+ const source = (0, react.useMemo)(() => session !== void 0 ? sessionSource(session) : world !== void 0 ? worldSource(world) : void 0, [session, world]);
12262
+ if (source === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12263
+ style: {
12264
+ padding: 24,
12265
+ fontSize: 13
12266
+ },
12267
+ children: t("notRoleplay")
12268
+ });
12269
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorldEditor, {
12270
+ t,
12271
+ source,
12272
+ notEditable: t("notRoleplay")
12273
+ });
12274
+ }
12275
+ //#endregion
12276
+ //#region src/client/world/index.ts
12277
+ const NAMESPACE$3 = "roleplay.world";
12278
+ const VIEW_ID$1 = "roleplay-world";
12279
+ /** The shell activates a data target for every view tab; this tab reads from the host itself, so its target is empty. */
12280
+ const worldTarget = {
12281
+ target: VIEW_ID$1,
12282
+ create: () => ({
12283
+ empty: {},
12284
+ replace: () => ({}),
12285
+ apply: () => ({})
12286
+ })
12287
+ };
12288
+ /** Adds the World tab beside Chat: the state of the story, by the part of the world. */
12289
+ function registerWorld(ctx) {
12290
+ const t = ctx.locale.bind(NAMESPACE$3);
12291
+ ctx.effect(() => ctx.locale.register(NAMESPACE$3, dictionaries$9), "roleplay: world dictionaries");
12292
+ ctx.inject(["uiConversation"], (scope) => {
12293
+ scope.uiConversation.views.register(worldTarget);
10469
12294
  scope.slots.inject("conversation.view", () => scope.slots.register({
10470
12295
  name: "conversation.view",
10471
12296
  id: VIEW_ID$1,
@@ -10477,7 +12302,7 @@ window.__ModuleLoader__.load({
10477
12302
  }
10478
12303
  //#endregion
10479
12304
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/chat-settings/ChatSettingsView.module.css.mjs
10480
- const css$3 = ".rp_wLpbxW_view{box-sizing:border-box;flex-direction:column;gap:16px;width:100%;max-width:640px;margin:0 auto;padding:24px 24px 240px;display:flex}.rp_wLpbxW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_wLpbxW_description{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_wLpbxW_field{flex-direction:column;gap:6px;max-width:200px;display:flex}.rp_wLpbxW_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_wLpbxW_help{max-width:560px;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_wLpbxW_actions{align-items:center;gap:12px;display:flex}.rp_wLpbxW_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:40px 0;font-size:13px}.rp_wLpbxW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_wLpbxW_saved{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_wLpbxW_row{flex-direction:column;gap:6px;display:flex}.rp_wLpbxW_notice{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);margin:0;padding:8px 12px;font-size:12px}.rp_wLpbxW_activity{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;display:flex}.rp_wLpbxW_activity summary{cursor:pointer;color:var(--dsw-alias-label-primary);font-weight:500}.rp_wLpbxW_link{font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;border:0;align-self:flex-start;padding:0;font-size:12px}.rp_wLpbxW_table{border-collapse:collapse;width:100%;font-size:12px}.rp_wLpbxW_table th,.rp_wLpbxW_table td{border-bottom:1px solid var(--dsw-alias-border-l4);text-align:left;vertical-align:top;overflow-wrap:anywhere;padding:3px 8px 3px 0}.rp_wLpbxW_table th{color:var(--dsw-alias-label-tertiary);font-weight:400}.rp_wLpbxW_table th:first-child,.rp_wLpbxW_table td:first-child,.rp_wLpbxW_table th:nth-child(3),.rp_wLpbxW_table td:nth-child(3),.rp_wLpbxW_table th:nth-child(4),.rp_wLpbxW_table td:nth-child(4),.rp_wLpbxW_table th:nth-child(5),.rp_wLpbxW_table td:nth-child(5){white-space:nowrap}";
12305
+ const css$3 = ".rp_wLpbxW_view{box-sizing:border-box;flex-direction:column;gap:16px;width:100%;max-width:720px;margin:0 auto;padding:24px 24px 240px;display:flex}.rp_wLpbxW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_wLpbxW_description{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_wLpbxW_field{flex-direction:column;gap:6px;width:min(100%,320px);display:flex}.rp_wLpbxW_label{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_wLpbxW_help{max-width:560px;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.rp_wLpbxW_actions{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.rp_wLpbxW_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:40px 0;font-size:13px}.rp_wLpbxW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_wLpbxW_saved{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_wLpbxW_row{flex-direction:column;gap:6px;display:flex}.rp_wLpbxW_notice{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);margin:0;padding:8px 12px;font-size:12px}.rp_wLpbxW_activity{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;display:flex}.rp_wLpbxW_activity summary{cursor:pointer;color:var(--dsw-alias-label-primary);font-weight:500}.rp_wLpbxW_link{font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;border:0;align-self:flex-start;padding:0;font-size:12px}.rp_wLpbxW_table{border-collapse:collapse;width:100%;font-size:12px}.rp_wLpbxW_table th,.rp_wLpbxW_table td{border-bottom:.5px solid var(--dsw-alias-border-l4);text-align:left;vertical-align:top;overflow-wrap:anywhere;padding:3px 8px 3px 0}.rp_wLpbxW_table th{color:var(--dsw-alias-label-tertiary);font-weight:400}.rp_wLpbxW_table th:first-child,.rp_wLpbxW_table td:first-child,.rp_wLpbxW_table th:nth-child(3),.rp_wLpbxW_table td:nth-child(3),.rp_wLpbxW_table th:nth-child(4),.rp_wLpbxW_table td:nth-child(4),.rp_wLpbxW_table th:nth-child(5),.rp_wLpbxW_table td:nth-child(5){white-space:nowrap}.rp_wLpbxW_run{flex-direction:column;gap:4px;padding:4px 0 8px;display:flex}.rp_wLpbxW_pre{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-markdown-code-block);white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;margin:4px 0;padding:6px 8px;font-size:12px;overflow:auto}.rp_wLpbxW_reasons{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:4px 0;padding-left:20px;font-size:12px}.rp_wLpbxW_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%;max-width:320px;height:32px;color:var(--dsw-alias-label-primary);font:inherit;padding:0 8px;font-size:13px}.rp_wLpbxW_list{color:var(--dsw-alias-label-tertiary);margin:0;padding-left:18px;font-size:12px;line-height:18px}@media (width<=640px){.rp_wLpbxW_view{padding-inline:16px}.rp_wLpbxW_table{display:block;overflow-x:auto}}";
10481
12306
  const key$3 = "src/client/chat-settings/ChatSettingsView.module.css";
10482
12307
  let tag$3 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$3) + "]");
10483
12308
  if (tag$3 === null) {
@@ -10488,20 +12313,25 @@ window.__ModuleLoader__.load({
10488
12313
  }
10489
12314
  tag$3.textContent = css$3;
10490
12315
  var ChatSettingsView_module_css_default = {
10491
- "saved": "rp_wLpbxW_saved",
12316
+ "actions": "rp_wLpbxW_actions",
10492
12317
  "activity": "rp_wLpbxW_activity",
12318
+ "message": "rp_wLpbxW_message",
10493
12319
  "view": "rp_wLpbxW_view",
10494
12320
  "field": "rp_wLpbxW_field",
10495
- "description": "rp_wLpbxW_description",
10496
- "message": "rp_wLpbxW_message",
10497
- "link": "rp_wLpbxW_link",
10498
- "row": "rp_wLpbxW_row",
10499
- "actions": "rp_wLpbxW_actions",
10500
- "label": "rp_wLpbxW_label",
12321
+ "table": "rp_wLpbxW_table",
10501
12322
  "help": "rp_wLpbxW_help",
12323
+ "reasons": "rp_wLpbxW_reasons",
12324
+ "pre": "rp_wLpbxW_pre",
12325
+ "label": "rp_wLpbxW_label",
12326
+ "saved": "rp_wLpbxW_saved",
10502
12327
  "title": "rp_wLpbxW_title",
10503
- "table": "rp_wLpbxW_table",
10504
12328
  "error": "rp_wLpbxW_error",
12329
+ "link": "rp_wLpbxW_link",
12330
+ "row": "rp_wLpbxW_row",
12331
+ "run": "rp_wLpbxW_run",
12332
+ "list": "rp_wLpbxW_list",
12333
+ "description": "rp_wLpbxW_description",
12334
+ "select": "rp_wLpbxW_select",
10505
12335
  "notice": "rp_wLpbxW_notice"
10506
12336
  };
10507
12337
  //#endregion
@@ -10543,6 +12373,264 @@ window.__ModuleLoader__.load({
10543
12373
  });
10544
12374
  if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
10545
12375
  }
12376
+ /** Starts the characters sorting what they took in; it runs in the background. */
12377
+ async function startReflection(id, signal) {
12378
+ const response = await fetch(`${API_PREFIX}/sessions/reflect?id=${encodeURIComponent(id)}`, {
12379
+ method: "POST",
12380
+ credentials: "same-origin",
12381
+ signal
12382
+ });
12383
+ if (!response.ok) {
12384
+ const body = await response.json().catch(() => void 0);
12385
+ throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
12386
+ }
12387
+ }
12388
+ /** What a helper run was told and did; nothing when the run was not kept or has been dropped. */
12389
+ async function loadRun(id, run, signal) {
12390
+ const response = await fetch(`${API_PREFIX}/sessions/activity/run?id=${encodeURIComponent(id)}&run=${encodeURIComponent(run)}`, {
12391
+ credentials: "same-origin",
12392
+ signal
12393
+ });
12394
+ if (response.status === 404) return void 0;
12395
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
12396
+ return await response.json();
12397
+ }
12398
+ async function interfaceReply(response) {
12399
+ if (!response.ok) {
12400
+ const body = await response.json().catch(() => void 0);
12401
+ const problems = Array.isArray(body?.problems) ? body.problems.map((problem) => `${problem.path ?? ""} ${problem.message ?? ""}`.trim()).join("; ") : "";
12402
+ throw new Error(`${typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim()}${problems === "" ? "" : ` (${problems})`}`);
12403
+ }
12404
+ return await response.json();
12405
+ }
12406
+ /** The interface pack of the chat's story: the one in use, the ones it could use, and how the world's compare with its copies. */
12407
+ async function loadInterfaceStatus(id, signal) {
12408
+ return await interfaceReply(await fetch(`${API_PREFIX}/sessions/interface/status?id=${encodeURIComponent(id)}`, {
12409
+ credentials: "same-origin",
12410
+ signal
12411
+ }));
12412
+ }
12413
+ /** Brings the world's interface packs into the chat's story. */
12414
+ async function syncInterface(id, signal) {
12415
+ return await interfaceReply(await fetch(`${API_PREFIX}/sessions/interface/sync?id=${encodeURIComponent(id)}`, {
12416
+ method: "POST",
12417
+ credentials: "same-origin",
12418
+ signal
12419
+ }));
12420
+ }
12421
+ //#endregion
12422
+ //#region src/client/chat-settings/InterfaceSection.tsx
12423
+ const message = (failure) => failure instanceof Error ? failure.message : String(failure);
12424
+ /**
12425
+ * The interface pack of the story: which one is in use or why none is, a choice of the packs the story could use (kept
12426
+ * with the other settings, so it is saved with them), and, when the world's packs are not what the story copied, a way
12427
+ * to bring them in.
12428
+ */
12429
+ function InterfaceSection({ t, session, value, onChange, saved, disabled }) {
12430
+ const [status, setStatus] = (0, react.useState)(void 0);
12431
+ const [failure, setFailure] = (0, react.useState)(void 0);
12432
+ const [report, setReport] = (0, react.useState)(void 0);
12433
+ const [sure, setSure] = (0, react.useState)(false);
12434
+ const [version, setVersion] = (0, react.useState)(0);
12435
+ (0, react.useEffect)(() => {
12436
+ const abort = new AbortController();
12437
+ loadInterfaceStatus(session, abort.signal).then((next) => {
12438
+ setStatus(next);
12439
+ setFailure(void 0);
12440
+ }, (error) => {
12441
+ if (!abort.signal.aborted) setFailure(message(error));
12442
+ });
12443
+ return () => {
12444
+ abort.abort();
12445
+ };
12446
+ }, [
12447
+ session,
12448
+ saved,
12449
+ version
12450
+ ]);
12451
+ const update = () => {
12452
+ setSure(false);
12453
+ syncInterface(session, new AbortController().signal).then((done) => {
12454
+ setReport(t("packUpdated", {
12455
+ updated: done.updated.join(", ") || "-",
12456
+ added: done.added.join(", ") || "-"
12457
+ }));
12458
+ setFailure(void 0);
12459
+ setVersion((number) => number + 1);
12460
+ }, (error) => {
12461
+ setReport(void 0);
12462
+ setFailure(t("packSyncFailed", { message: message(error) }));
12463
+ });
12464
+ };
12465
+ if (status === void 0) return failure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12466
+ className: ChatSettingsView_module_css_default.error,
12467
+ role: "alert",
12468
+ children: t("packLoadFailed", { message: failure })
12469
+ });
12470
+ const inUse = status.available.find((entry) => entry.id === status.active);
12471
+ const changed = status.world?.packs.filter((entry) => entry.state === "different").map((entry) => entry.id) ?? [];
12472
+ const fresh = status.world?.packs.filter((entry) => entry.state === "new").map((entry) => entry.id) ?? [];
12473
+ const broken = status.world?.packs.filter((entry) => entry.problems.length > 0).map((entry) => entry.id) ?? [];
12474
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
12475
+ className: ChatSettingsView_module_css_default.activity,
12476
+ "data-testid": "roleplay-interface-pack",
12477
+ children: [
12478
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("packTitle") }),
12479
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12480
+ className: ChatSettingsView_module_css_default.description,
12481
+ children: t("packHelp")
12482
+ }),
12483
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12484
+ className: ChatSettingsView_module_css_default.description,
12485
+ children: status.setting === "none" ? t("packOff") : inUse === void 0 ? t("packNone") : t("packActive", { name: inUse.name })
12486
+ }),
12487
+ inUse !== void 0 && inUse.surfaces.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12488
+ className: ChatSettingsView_module_css_default.help,
12489
+ children: t("packSurfaces", { surfaces: inUse.surfaces.join(", ") })
12490
+ }),
12491
+ status.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12492
+ role: "alert",
12493
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12494
+ className: ChatSettingsView_module_css_default.error,
12495
+ children: t("packProblems")
12496
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
12497
+ className: ChatSettingsView_module_css_default.list,
12498
+ children: status.problems.map((problem, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: problem.file === "" ? problem.message : `${problem.file}: ${problem.message}` }, index))
12499
+ })]
12500
+ }),
12501
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
12502
+ className: ChatSettingsView_module_css_default.field,
12503
+ style: { maxWidth: "none" },
12504
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12505
+ className: ChatSettingsView_module_css_default.label,
12506
+ children: t("packChoose")
12507
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
12508
+ className: ChatSettingsView_module_css_default.select,
12509
+ value,
12510
+ disabled,
12511
+ onChange: (event) => {
12512
+ onChange(event.target.value);
12513
+ },
12514
+ children: [
12515
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12516
+ value: "",
12517
+ children: t("packFirst")
12518
+ }),
12519
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12520
+ value: "none",
12521
+ children: t("packPlain")
12522
+ }),
12523
+ status.available.map((entry) => {
12524
+ const name = status.available.filter((other) => other.name === entry.name).length > 1 ? `${entry.name} — ${entry.id}` : entry.name;
12525
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12526
+ value: entry.id,
12527
+ children: entry.problems.length > 0 ? t("packBroken", { name }) : entry.from === "root" ? t("packFromRoot", { name }) : name
12528
+ }, entry.id);
12529
+ })
12530
+ ]
12531
+ })]
12532
+ }),
12533
+ changed.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12534
+ className: ChatSettingsView_module_css_default.description,
12535
+ children: t("packWorldChanged", { names: changed.join(", ") })
12536
+ }),
12537
+ fresh.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12538
+ className: ChatSettingsView_module_css_default.description,
12539
+ children: t("packWorldNew", { names: fresh.join(", ") })
12540
+ }),
12541
+ broken.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12542
+ className: ChatSettingsView_module_css_default.error,
12543
+ children: t("packWorldProblems", { names: broken.join(", ") })
12544
+ }),
12545
+ (changed.length > 0 || fresh.length > 0) && broken.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
12546
+ variant: "ghost",
12547
+ size: "sm",
12548
+ disabled,
12549
+ onClick: () => {
12550
+ if (sure) update();
12551
+ else setSure(true);
12552
+ },
12553
+ children: sure ? t("packUpdateConfirm") : t("packUpdate")
12554
+ }), sure && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12555
+ type: "button",
12556
+ className: ChatSettingsView_module_css_default.link,
12557
+ onClick: () => {
12558
+ setSure(false);
12559
+ },
12560
+ children: t("vectorsCancel")
12561
+ })] }),
12562
+ report !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12563
+ className: ChatSettingsView_module_css_default.description,
12564
+ role: "status",
12565
+ children: report
12566
+ }),
12567
+ failure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12568
+ className: ChatSettingsView_module_css_default.error,
12569
+ role: "alert",
12570
+ children: failure
12571
+ })
12572
+ ]
12573
+ });
12574
+ }
12575
+ //#endregion
12576
+ //#region src/client/chat-settings/ReflectionSection.tsx
12577
+ const POLL_MS$1 = 3e3;
12578
+ /** When the characters last sorted what they took in, and a way to have them do it now. */
12579
+ function ReflectionSection({ t, status, onStart, onRefresh, disabled }) {
12580
+ (0, react.useEffect)(() => {
12581
+ if (!status.running) return void 0;
12582
+ const timer = setInterval(onRefresh, POLL_MS$1);
12583
+ return () => {
12584
+ clearInterval(timer);
12585
+ };
12586
+ }, [status.running, onRefresh]);
12587
+ const reasons = {
12588
+ turns: t("reflectTurns"),
12589
+ scene: t("reflectScene"),
12590
+ manual: t("reflectManual")
12591
+ };
12592
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
12593
+ className: ChatSettingsView_module_css_default.activity,
12594
+ "data-testid": "roleplay-reflection",
12595
+ children: [
12596
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("reflectTitle") }),
12597
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12598
+ className: ChatSettingsView_module_css_default.description,
12599
+ children: status.running ? t("reflectRunning") : status.last === void 0 ? t("reflectNone") : t("reflectLast", {
12600
+ turn: status.last.turn,
12601
+ reason: reasons[status.last.reason]
12602
+ })
12603
+ }),
12604
+ !status.running && status.last !== void 0 && (status.last.characters.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12605
+ className: ChatSettingsView_module_css_default.description,
12606
+ children: t("reflectNothing")
12607
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
12608
+ className: ChatSettingsView_module_css_default.description,
12609
+ children: status.last.characters.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: t("reflectOutcome", {
12610
+ name: entry.name,
12611
+ added: entry.added,
12612
+ revised: entry.revised,
12613
+ dropped: entry.dropped
12614
+ }) }, entry.name))
12615
+ })),
12616
+ status.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12617
+ className: ChatSettingsView_module_css_default.error,
12618
+ role: "alert",
12619
+ children: t("reflectError", { message: status.error.message })
12620
+ }),
12621
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
12622
+ variant: "ghost",
12623
+ size: "sm",
12624
+ disabled: disabled || status.running,
12625
+ onClick: onStart,
12626
+ children: t("reflectNow")
12627
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12628
+ className: ChatSettingsView_module_css_default.description,
12629
+ children: t("reflectHelp")
12630
+ })] })
12631
+ ]
12632
+ });
12633
+ }
10546
12634
  //#endregion
10547
12635
  //#region src/client/chat-settings/VectorsSection.tsx
10548
12636
  /** What the search by meaning stands on, and a way to start it again with another embedding model. */
@@ -10595,8 +12683,30 @@ window.__ModuleLoader__.load({
10595
12683
  //#region src/client/chat-settings/ActivityList.tsx
10596
12684
  const seconds = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 1 : 0)} s`;
10597
12685
  /** What the story's helper agents did lately and how long it took, newest first, to see where a slow turn went or why a helper gave up. */
10598
- function ActivityList({ t, entries, onRefresh }) {
12686
+ function ActivityList({ t, session, entries, onRefresh }) {
10599
12687
  const shown = entries.slice(-20).reverse();
12688
+ const [open, setOpen] = (0, react.useState)();
12689
+ const toggle = (run) => {
12690
+ if (open?.run === run) {
12691
+ setOpen(void 0);
12692
+ return;
12693
+ }
12694
+ setOpen({
12695
+ run,
12696
+ detail: "loading"
12697
+ });
12698
+ loadRun(session, run, new AbortController().signal).then((detail) => {
12699
+ setOpen((current) => current?.run === run ? {
12700
+ run,
12701
+ detail: detail ?? "gone"
12702
+ } : current);
12703
+ }, (failure) => {
12704
+ setOpen((current) => current?.run === run ? {
12705
+ run,
12706
+ detail: { error: failure instanceof Error ? failure.message : String(failure) }
12707
+ } : current);
12708
+ });
12709
+ };
10600
12710
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
10601
12711
  className: ChatSettingsView_module_css_default.activity,
10602
12712
  "data-testid": "roleplay-activity",
@@ -10623,8 +12733,9 @@ window.__ModuleLoader__.load({
10623
12733
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("activityModel") }),
10624
12734
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("activityTook") }),
10625
12735
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("activityCalls") }),
10626
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("activityResult") })
10627
- ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: shown.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
12736
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("activityResult") }),
12737
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {})
12738
+ ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: shown.flatMap((entry) => [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
10628
12739
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: new Date(entry.at).toLocaleTimeString() }),
10629
12740
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.label }),
10630
12741
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.model === "" ? t("activityOwnModel") : entry.model }),
@@ -10634,8 +12745,139 @@ window.__ModuleLoader__.load({
10634
12745
  className: entry.error === void 0 ? void 0 : ChatSettingsView_module_css_default.error,
10635
12746
  title: entry.error,
10636
12747
  children: entry.error === void 0 ? t("activityDone") : t("activityFailed", { reason: entry.error })
12748
+ }),
12749
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.run === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12750
+ type: "button",
12751
+ className: ChatSettingsView_module_css_default.link,
12752
+ onClick: () => {
12753
+ toggle(entry.run);
12754
+ },
12755
+ children: open?.run === entry.run ? t("runHide") : t("runShow")
12756
+ }) })
12757
+ ] }, `${entry.at}-${entry.label}`), ...entry.run !== void 0 && open?.run === entry.run ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
12758
+ colSpan: 7,
12759
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunView, {
12760
+ t,
12761
+ detail: open.detail
10637
12762
  })
10638
- ] }, `${entry.at}-${entry.label}`)) })]
12763
+ }) }, `${entry.at}-${entry.label}-run`)] : []]) })]
12764
+ })
12765
+ ]
12766
+ });
12767
+ }
12768
+ function RunView({ t, detail }) {
12769
+ if (detail === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12770
+ className: ChatSettingsView_module_css_default.description,
12771
+ children: t("loading")
12772
+ });
12773
+ if (detail === "gone") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12774
+ className: ChatSettingsView_module_css_default.description,
12775
+ children: t("runGone")
12776
+ });
12777
+ if ("error" in detail) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12778
+ className: ChatSettingsView_module_css_default.description,
12779
+ role: "alert",
12780
+ children: t("runFailed", { message: detail.error })
12781
+ });
12782
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12783
+ className: ChatSettingsView_module_css_default.run,
12784
+ "data-testid": "roleplay-run",
12785
+ children: [
12786
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("runPersona") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
12787
+ className: ChatSettingsView_module_css_default.pre,
12788
+ children: detail.persona
12789
+ })] }),
12790
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
12791
+ open: true,
12792
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("runPrompt") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
12793
+ className: ChatSettingsView_module_css_default.pre,
12794
+ children: detail.prompt
12795
+ })]
12796
+ }),
12797
+ detail.recalled !== void 0 && detail.recalled.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("runRecalled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
12798
+ className: ChatSettingsView_module_css_default.reasons,
12799
+ "data-testid": "roleplay-run-recalled",
12800
+ children: detail.recalled.map((memory, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [
12801
+ `${memory.clarity}, turn ${memory.turn}: ${memory.text}`,
12802
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
12803
+ whyText(t, memory.why)
12804
+ ] }, index))
12805
+ })] }),
12806
+ detail.calls.map((call, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [
12807
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
12808
+ className: call.failed ? ChatSettingsView_module_css_default.error : void 0,
12809
+ children: `${index + 1}. ${call.tool}${call.failed ? ` (${t("runRefused")})` : ""}`
12810
+ }),
12811
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
12812
+ className: ChatSettingsView_module_css_default.pre,
12813
+ children: call.args
12814
+ }),
12815
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
12816
+ className: ChatSettingsView_module_css_default.pre,
12817
+ children: call.outcome
12818
+ })
12819
+ ] }, index)),
12820
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("runResult") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
12821
+ className: ChatSettingsView_module_css_default.pre,
12822
+ children: detail.result ?? t("runNoResult")
12823
+ })] })
12824
+ ]
12825
+ });
12826
+ }
12827
+ const figure = (value) => (Math.round(value * 100) / 100).toString();
12828
+ /** The reasons a thing came back, one short line. */
12829
+ function whyText(t, why) {
12830
+ if (why === void 0) return "";
12831
+ return [
12832
+ t("whyCues", {
12833
+ people: figure(why.cues.people),
12834
+ words: figure(why.cues.words),
12835
+ place: figure(why.cues.place)
12836
+ }),
12837
+ ...why.lexical === void 0 ? [] : [t("whyIndex", { value: figure(why.lexical) })],
12838
+ ...why.dense === void 0 ? [] : [t("whyMeaning", { value: figure(why.dense) })],
12839
+ ...why.rerank === void 0 ? [] : [t("whyRerank", { value: figure(why.rerank) })],
12840
+ t("whyMatters", { value: why.importance }),
12841
+ t("whyAge", { value: figure(why.ageDays) }),
12842
+ ...why.retention === void 0 ? [] : [t("whyKept", { value: figure(why.retention) })],
12843
+ t("whyScore", { value: figure(why.score) }),
12844
+ ...why.linked === void 0 ? [] : [t("whyLinked", {
12845
+ people: why.linked.people,
12846
+ tags: why.linked.tags,
12847
+ place: why.linked.place ? t("whyLinkedPlace") : ""
12848
+ })]
12849
+ ].join(" · ");
12850
+ }
12851
+ //#endregion
12852
+ //#region src/client/chat-settings/InterventionList.tsx
12853
+ /** What the story's triggers delivered lately, and whether the game master or the characters took it up, newest first. */
12854
+ function InterventionList({ t, entries }) {
12855
+ const shown = [...entries].reverse();
12856
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
12857
+ className: ChatSettingsView_module_css_default.activity,
12858
+ "data-testid": "roleplay-interventions",
12859
+ children: [
12860
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("interventionsTitle") }),
12861
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12862
+ className: ChatSettingsView_module_css_default.description,
12863
+ children: t("interventionsHelp")
12864
+ }),
12865
+ shown.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12866
+ className: ChatSettingsView_module_css_default.description,
12867
+ children: t("interventionsEmpty")
12868
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
12869
+ className: ChatSettingsView_module_css_default.table,
12870
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
12871
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("interventionTurn") }),
12872
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("interventionKind") }),
12873
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("interventionText") }),
12874
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("interventionStatus") })
12875
+ ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: shown.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
12876
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.turn }),
12877
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.kind === "beat" ? t("interventionBeat") : t("interventionCue", { who: entry.characters.join(", ") }) }),
12878
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.text }),
12879
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.status === "withdrawn" ? t("interventionWithdrawn", { reason: entry.reason ?? "" }) : t(entry.status === "waiting" ? "interventionWaiting" : entry.status === "taken" ? "interventionTaken" : "interventionLapsed") })
12880
+ ] }, `${entry.turn}-${entry.kind}-${entry.trigger}-${entry.text}`)) })]
10639
12881
  })
10640
12882
  ]
10641
12883
  });
@@ -10700,6 +12942,13 @@ window.__ModuleLoader__.load({
10700
12942
  setError(t("vectorsFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
10701
12943
  });
10702
12944
  };
12945
+ const reflect = () => {
12946
+ if (session === void 0) return;
12947
+ setError(void 0);
12948
+ startReflection(session, new AbortController().signal).then(refreshActivity, (failure) => {
12949
+ setError(t("reflectFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
12950
+ });
12951
+ };
10703
12952
  const refreshActivity = () => {
10704
12953
  if (session === void 0) return;
10705
12954
  loadSettings(session, new AbortController().signal).then((next) => {
@@ -10708,7 +12957,9 @@ window.__ModuleLoader__.load({
10708
12957
  payload: {
10709
12958
  ...payload,
10710
12959
  activity: next.activity,
12960
+ interventions: next.interventions,
10711
12961
  vectors: next.vectors,
12962
+ reflection: next.reflection,
10712
12963
  pendingRecords: next.pendingRecords,
10713
12964
  pendingConsolidation: next.pendingConsolidation
10714
12965
  }
@@ -10774,16 +13025,39 @@ window.__ModuleLoader__.load({
10774
13025
  },
10775
13026
  options,
10776
13027
  disabled: saving,
13028
+ hidden: ["interface.pack"],
10777
13029
  locked: payload.clockMode === "simulated" ? { "clock.mode": { real: t("clockLocked") } } : {}
10778
13030
  }),
13031
+ session !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InterfaceSection, {
13032
+ t,
13033
+ session,
13034
+ value: String(drafts["interface.pack"] ?? ""),
13035
+ onChange: (next) => {
13036
+ change("interface.pack", next);
13037
+ },
13038
+ saved: payload.settings.interface.pack,
13039
+ disabled: saving
13040
+ }),
13041
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReflectionSection, {
13042
+ t,
13043
+ status: payload.reflection,
13044
+ disabled: saving,
13045
+ onStart: reflect,
13046
+ onRefresh: refreshActivity
13047
+ }),
10779
13048
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VectorsSection, {
10780
13049
  t,
10781
13050
  status: payload.vectors,
10782
13051
  disabled: saving,
10783
13052
  onReset: reset
10784
13053
  }),
10785
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivityList, {
13054
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InterventionList, {
10786
13055
  t,
13056
+ entries: payload.interventions
13057
+ }),
13058
+ session !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivityList, {
13059
+ t,
13060
+ session,
10787
13061
  entries: payload.activity,
10788
13062
  onRefresh: refreshActivity
10789
13063
  }),
@@ -10818,6 +13092,19 @@ window.__ModuleLoader__.load({
10818
13092
  notRoleplay: "This chat is not a roleplay session, so it has no roleplay settings.",
10819
13093
  pendingConsolidation: "{count} character(s), place(s) or thing(s) made up in play are waiting to be fitted into the world (connected to the rest, given relationships). It is done in the background.",
10820
13094
  pendingRecords: "{count} round(s) are waiting to be written into the story's memory. The game master records them when the story moves on, or once too many pile up.",
13095
+ interventionsTitle: "What the world put in front of the story",
13096
+ interventionsHelp: "Beats and cues that triggers delivered lately. A beat is for the game master to weave in; a cue is for characters. Taken up means it was used; lapsed means nobody did within its time; withdrawn means that when it was to be told it no longer applied (or its words could not be written), and the reason is shown.",
13097
+ interventionsEmpty: "No trigger has delivered anything yet.",
13098
+ interventionTurn: "Turn",
13099
+ interventionKind: "For",
13100
+ interventionText: "What",
13101
+ interventionStatus: "Became of it",
13102
+ interventionBeat: "Game master (beat)",
13103
+ interventionCue: "Cue for {who}",
13104
+ interventionWaiting: "Waiting",
13105
+ interventionTaken: "Taken up",
13106
+ interventionLapsed: "Lapsed, nobody took it up",
13107
+ interventionWithdrawn: "Withdrawn: {reason}",
10821
13108
  activityTitle: "What the helpers did lately",
10822
13109
  activityHelp: "Characters, the record keeper, the suggestion writer and the authors run in the background of a turn. The latest runs are listed here, with how long each took.",
10823
13110
  activityRefresh: "Refresh",
@@ -10831,6 +13118,26 @@ window.__ModuleLoader__.load({
10831
13118
  activityOwnModel: "chat model",
10832
13119
  activityDone: "done",
10833
13120
  activityFailed: "failed: {reason}",
13121
+ runShow: "Show",
13122
+ runHide: "Hide",
13123
+ runGone: "This run was not kept, or has been dropped to make room for newer ones.",
13124
+ runFailed: "Could not load the run: {message}",
13125
+ runPersona: "Instructions",
13126
+ runPrompt: "What it was asked",
13127
+ runRefused: "refused",
13128
+ runResult: "Result",
13129
+ runRecalled: "What it was reminded of, and why",
13130
+ whyCues: "cues: names {people}, words {words}, place {place}",
13131
+ whyIndex: "words search {value}",
13132
+ whyMeaning: "meaning search {value}",
13133
+ whyRerank: "reranker {value}",
13134
+ whyMatters: "matters {value}/5",
13135
+ whyAge: "{value} story days ago",
13136
+ whyKept: "still in mind {value}",
13137
+ whyScore: "ranked {value}",
13138
+ whyLinked: "came to mind with another memory (shares {people} people, {tags} tags{place})",
13139
+ whyLinkedPlace: ", the place",
13140
+ runNoResult: "It submitted no result.",
10834
13141
  vectorsTitle: "Search by meaning",
10835
13142
  vectorsUnavailable: "Vector search is not available here, so memories are found by their words only.",
10836
13143
  vectorsNone: "No vectors are stored yet ({pending} texts waiting). They are made in the background once an embedding model is selected and the story searches.",
@@ -10840,6 +13147,39 @@ window.__ModuleLoader__.load({
10840
13147
  vectorsCancel: "Cancel",
10841
13148
  vectorsHelp: "Use this after you select another embedding model. The texts stay; they are embedded again by the new model as the story needs them, and until then memories are found by their words.",
10842
13149
  vectorsFailed: "Could not reset the vectors: {message}",
13150
+ reflectTitle: "Reflection",
13151
+ reflectNone: "The characters have not sorted their memories yet.",
13152
+ reflectLast: "Last pass after turn {turn} ({reason}).",
13153
+ reflectTurns: "on schedule",
13154
+ reflectScene: "the scene changed",
13155
+ reflectManual: "started by you",
13156
+ reflectOutcome: "{name}: {added} new, {revised} changed, {dropped} let go",
13157
+ reflectNothing: "No character had enough new to sort.",
13158
+ reflectRunning: "The characters are sorting what they took in…",
13159
+ reflectNow: "Reflect now",
13160
+ 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.",
13161
+ reflectFailed: "Could not start the reflection: {message}",
13162
+ reflectError: "The last pass failed: {message}",
13163
+ packTitle: "Interface pack",
13164
+ packHelp: "A pack changes how this story looks and can add a status strip, buttons, an opening card, a backdrop or a tab. A world can carry packs; yours go in the ui folder of your roleplay folder.",
13165
+ packActive: "In use: {name}",
13166
+ packNone: "No pack is in use.",
13167
+ packOff: "Packs are turned off for this story.",
13168
+ packProblems: "The pack cannot be used:",
13169
+ packChoose: "Pack",
13170
+ packFirst: "The first pack of the story",
13171
+ packPlain: "None (plain chat)",
13172
+ packFromRoot: "{name} (from your ui folder)",
13173
+ packWorldChanged: "The world has changed {names} since this story started.",
13174
+ packWorldNew: "The world has {names}, which this story does not have.",
13175
+ packWorldProblems: "The world's packs cannot be brought in yet: {names} has problems.",
13176
+ packUpdate: "Update from the world",
13177
+ packUpdateConfirm: "Replace the story's copies?",
13178
+ packUpdated: "Updated: {updated}. Added: {added}. The replaced copies were kept in the story's .trash folder.",
13179
+ packSyncFailed: "Could not update the packs: {message}",
13180
+ packSurfaces: "Shows: {surfaces}",
13181
+ packLoadFailed: "Could not read the interface pack: {message}",
13182
+ packBroken: "{name} (has problems)",
10843
13183
  save: "Save",
10844
13184
  saving: "Saving…",
10845
13185
  saved: "Saved.",
@@ -10854,6 +13194,19 @@ window.__ModuleLoader__.load({
10854
13194
  notRoleplay: "此对话不是角色扮演存档,没有角色扮演设置。",
10855
13195
  pendingConsolidation: "有 {count} 个在故事中新建的角色、地点或物品等待融入世界(与其余部分建立连接和关系),将在后台完成。",
10856
13196
  pendingRecords: "有 {count} 个回合等待写入故事记忆。主持人会在故事推进时记录,积压过多时也会自动记录。",
13197
+ interventionsTitle: "世界摆到故事面前的东西",
13198
+ interventionsHelp: "触发器最近送出的节拍与提示。节拍交给游戏主持人织入故事,提示交给角色。“已采用”表示被用上了,“已失效”表示在期限内没有人理会,“已撤回”表示轮到它被说出时已不再适用(或其文字无法写出),并显示原因。",
13199
+ interventionsEmpty: "还没有触发器送出过任何东西。",
13200
+ interventionTurn: "回合",
13201
+ interventionKind: "送给",
13202
+ interventionText: "内容",
13203
+ interventionStatus: "结果",
13204
+ interventionBeat: "游戏主持人(节拍)",
13205
+ interventionCue: "给 {who} 的提示",
13206
+ interventionWaiting: "等待中",
13207
+ interventionTaken: "已采用",
13208
+ interventionLapsed: "已失效,无人理会",
13209
+ interventionWithdrawn: "已撤回:{reason}",
10857
13210
  activityTitle: "助手最近做了什么",
10858
13211
  activityHelp: "角色、记录员、建议作者和世界作者都在每一轮的后台运行。这里列出最近的运行及各自耗时。",
10859
13212
  activityRefresh: "刷新",
@@ -10867,6 +13220,26 @@ window.__ModuleLoader__.load({
10867
13220
  activityOwnModel: "对话模型",
10868
13221
  activityDone: "完成",
10869
13222
  activityFailed: "失败:{reason}",
13223
+ runShow: "查看",
13224
+ runHide: "收起",
13225
+ runGone: "这次运行没有保留,或已被较新的运行挤出。",
13226
+ runFailed: "无法加载这次运行:{message}",
13227
+ runPersona: "指令",
13228
+ runPrompt: "被问的内容",
13229
+ runRefused: "被拒绝",
13230
+ runResult: "结果",
13231
+ runRecalled: "它被提醒了什么,以及原因",
13232
+ whyCues: "线索:人名 {people},字词 {words},地点 {place}",
13233
+ whyIndex: "字词检索 {value}",
13234
+ whyMeaning: "含义检索 {value}",
13235
+ whyRerank: "重排序 {value}",
13236
+ whyMatters: "重要性 {value}/5",
13237
+ whyAge: "{value} 个故事日前",
13238
+ whyKept: "记忆保留 {value}",
13239
+ whyScore: "排名分 {value}",
13240
+ whyLinked: "与另一条记忆一同想起(共有 {people} 个人物、{tags} 个标签{place})",
13241
+ whyLinkedPlace: "、地点",
13242
+ runNoResult: "它没有提交结果。",
10870
13243
  vectorsTitle: "按含义检索",
10871
13244
  vectorsUnavailable: "此处无法使用向量检索,记忆只按字词查找。",
10872
13245
  vectorsNone: "尚未存储向量({pending} 条文本等待中)。选择嵌入模型并在故事检索时会在后台生成。",
@@ -10876,12 +13249,45 @@ window.__ModuleLoader__.load({
10876
13249
  vectorsCancel: "取消",
10877
13250
  vectorsHelp: "更换嵌入模型后使用。文本会保留,之后按需由新模型重新生成向量,在此之前记忆只按字词查找。",
10878
13251
  vectorsFailed: "无法重置向量:{message}",
13252
+ reflectTitle: "反思",
13253
+ reflectNone: "角色们还没有整理过记忆。",
13254
+ reflectLast: "上一次在第 {turn} 回合之后({reason})。",
13255
+ reflectTurns: "按计划",
13256
+ reflectScene: "场景转换",
13257
+ reflectManual: "由你发起",
13258
+ reflectOutcome: "{name}:新增 {added},修改 {revised},放下 {dropped}",
13259
+ reflectNothing: "没有角色积攒了足够多的新见闻。",
13260
+ reflectRunning: "角色们正在整理所见所闻……",
13261
+ reflectNow: "立即反思",
13262
+ reflectHelp: "每个有新见闻的角色会把它们整理成自己的信念:合并、巩固或放下,每一条都要依据它接收到的事件。反思在后台进行,你可以继续游玩。",
13263
+ reflectFailed: "无法开始反思:{message}",
13264
+ reflectError: "上一次反思失败:{message}",
13265
+ packTitle: "界面包",
13266
+ packHelp: "界面包会改变此故事的外观,并可添加状态条、按钮、开场卡片、背景或标签页。世界可以自带界面包;你自己的放在角色扮演目录的 ui 文件夹中。",
13267
+ packActive: "使用中:{name}",
13268
+ packNone: "没有使用界面包。",
13269
+ packOff: "此故事已关闭界面包。",
13270
+ packProblems: "无法使用此界面包:",
13271
+ packChoose: "界面包",
13272
+ packFirst: "故事中的第一个包",
13273
+ packPlain: "无(普通聊天)",
13274
+ packFromRoot: "{name}(来自你的 ui 文件夹)",
13275
+ packWorldChanged: "自此故事开始以来,世界已更改:{names}。",
13276
+ packWorldNew: "世界有此故事没有的包:{names}。",
13277
+ packWorldProblems: "暂时无法带入世界的界面包:{names} 有问题。",
13278
+ packUpdate: "从世界更新",
13279
+ packUpdateConfirm: "替换故事中的副本?",
13280
+ packUpdated: "已更新:{updated}。已添加:{added}。被替换的副本保存在故事的 .trash 文件夹中。",
13281
+ packSyncFailed: "无法更新界面包:{message}",
13282
+ packSurfaces: "显示位置:{surfaces}",
13283
+ packLoadFailed: "无法读取界面包:{message}",
13284
+ packBroken: "{name}(有问题)",
10879
13285
  save: "保存",
10880
13286
  saving: "正在保存…",
10881
13287
  saved: "已保存。",
10882
13288
  saveFailed: "无法保存设置:{message}"
10883
13289
  }
10884
- }, dictionaries$5);
13290
+ }, dictionaries$6);
10885
13291
  //#endregion
10886
13292
  //#region src/client/chat-settings/index.ts
10887
13293
  const NAMESPACE$2 = "roleplay.chatSettings";
@@ -11186,7 +13592,7 @@ window.__ModuleLoader__.load({
11186
13592
  };
11187
13593
  //#endregion
11188
13594
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/transcript/NarrationView.module.css.mjs
11189
- 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{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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);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:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);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}.rp_NFPimG_playAll{float:right;margin:0 0 8px 12px;font-size:12px}.rp_NFPimG_playLine{margin-left:8px;padding:0 3px;font-size:10px}.rp_NFPimG_playAll:disabled,.rp_NFPimG_playLine:disabled{cursor:wait;opacity:.5}";
13595
+ 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}}";
11190
13596
  const key$2 = "src/client/transcript/NarrationView.module.css";
11191
13597
  let tag$2 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$2) + "]");
11192
13598
  if (tag$2 === null) {
@@ -11197,25 +13603,25 @@ window.__ModuleLoader__.load({
11197
13603
  }
11198
13604
  tag$2.textContent = css$2;
11199
13605
  var NarrationView_module_css_default = {
11200
- "oocLabel": "rp_NFPimG_oocLabel",
11201
- "images": "rp_NFPimG_images",
13606
+ "line": "rp_NFPimG_line",
13607
+ "playLine": "rp_NFPimG_playLine",
13608
+ "speech": "rp_NFPimG_speech",
13609
+ "preview": "rp_NFPimG_preview",
11202
13610
  "output": "rp_NFPimG_output",
13611
+ "note": "rp_NFPimG_note",
13612
+ "oocLabel": "rp_NFPimG_oocLabel",
13613
+ "oocRefused": "rp_NFPimG_oocRefused",
13614
+ "sceneImage": "rp_NFPimG_sceneImage",
11203
13615
  "words": "rp_NFPimG_words",
11204
- "speech": "rp_NFPimG_speech",
11205
- "name": "rp_NFPimG_name",
11206
- "imageButton": "rp_NFPimG_imageButton",
11207
- "imageStatus": "rp_NFPimG_imageStatus",
13616
+ "avatar": "rp_NFPimG_avatar",
13617
+ "images": "rp_NFPimG_images",
11208
13618
  "imageError": "rp_NFPimG_imageError",
11209
- "oocRefused": "rp_NFPimG_oocRefused",
11210
13619
  "playAll": "rp_NFPimG_playAll",
13620
+ "name": "rp_NFPimG_name",
11211
13621
  "narration": "rp_NFPimG_narration",
11212
- "note": "rp_NFPimG_note",
11213
- "playLine": "rp_NFPimG_playLine",
11214
- "avatar": "rp_NFPimG_avatar",
11215
13622
  "oocNote": "rp_NFPimG_oocNote",
11216
- "sceneImage": "rp_NFPimG_sceneImage",
11217
- "line": "rp_NFPimG_line",
11218
- "preview": "rp_NFPimG_preview"
13623
+ "imageButton": "rp_NFPimG_imageButton",
13624
+ "imageStatus": "rp_NFPimG_imageStatus"
11219
13625
  };
11220
13626
  //#endregion
11221
13627
  //#region src/client/transcript/PreviewNode.tsx
@@ -11280,6 +13686,7 @@ window.__ModuleLoader__.load({
11280
13686
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11281
13687
  className: NarrationView_module_css_default.output,
11282
13688
  "data-testid": "roleplay-narration",
13689
+ "data-rp": "narration",
11283
13690
  children: [
11284
13691
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
11285
13692
  type: "button",
@@ -11289,15 +13696,20 @@ window.__ModuleLoader__.load({
11289
13696
  onClick: () => {
11290
13697
  play(data.segments);
11291
13698
  },
11292
- children: ["▶ ", t(playing ? "speaking" : "speakAll")]
13699
+ children: [
13700
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { "aria-hidden": "true" }),
13701
+ " ",
13702
+ t(playing ? "speaking" : "speakAll")
13703
+ ]
11293
13704
  }),
11294
13705
  data.ooc !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
11295
13706
  className: data.ooc.legal ? NarrationView_module_css_default.oocNote : NarrationView_module_css_default.oocRefused,
11296
13707
  "data-testid": "roleplay-ooc",
13708
+ "data-rp": "ooc",
11297
13709
  children: [
11298
13710
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11299
13711
  className: NarrationView_module_css_default.oocLabel,
11300
- children: t(data.ooc.legal ? "oocDone" : "oocRefused")
13712
+ children: t(data.ooc.question === true ? "oocAnswer" : data.ooc.legal ? "oocDone" : "oocRefused")
11301
13713
  }),
11302
13714
  " ",
11303
13715
  data.ooc.note
@@ -11305,12 +13717,15 @@ window.__ModuleLoader__.load({
11305
13717
  }),
11306
13718
  data.segments.map((segment, index) => segment.type === "narration" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11307
13719
  className: NarrationView_module_css_default.narration,
13720
+ "data-rp": "prose",
11308
13721
  children: segment.text
11309
13722
  }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11310
13723
  className: NarrationView_module_css_default.line,
11311
13724
  "data-testid": "roleplay-utterance",
13725
+ "data-rp": "utterance",
11312
13726
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11313
13727
  className: NarrationView_module_css_default.avatar,
13728
+ "data-rp": "avatar",
11314
13729
  style: { background: `hsl(${hueOf(segment.name)} 32% 40%)` },
11315
13730
  "aria-hidden": "true",
11316
13731
  children: Array.from(segment.name)[0]?.toUpperCase()
@@ -11318,18 +13733,21 @@ window.__ModuleLoader__.load({
11318
13733
  className: NarrationView_module_css_default.speech,
11319
13734
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11320
13735
  className: NarrationView_module_css_default.name,
13736
+ "data-rp": "speaker",
11321
13737
  children: [segment.name, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11322
13738
  type: "button",
11323
13739
  className: NarrationView_module_css_default.playLine,
11324
13740
  disabled: playing,
13741
+ "aria-label": t("speakLine"),
11325
13742
  title: t("speakLine"),
11326
13743
  onClick: () => {
11327
13744
  play([segment]);
11328
13745
  },
11329
- children: "▶"
13746
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { "aria-hidden": "true" })
11330
13747
  })]
11331
13748
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11332
13749
  className: NarrationView_module_css_default.words,
13750
+ "data-rp": "words",
11333
13751
  children: segment.text
11334
13752
  })]
11335
13753
  })]
@@ -11442,7 +13860,7 @@ window.__ModuleLoader__.load({
11442
13860
  }
11443
13861
  //#endregion
11444
13862
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/transcript/SuggestionsDock.module.css.mjs
11445
- const css$1 = ".rp_rWH4DG_dock{box-sizing:border-box;flex-direction:column;align-items:stretch;gap:4px;width:min(800px,100%);min-width:0;margin:0 auto 8px;padding:0 16px;display:flex}.rp_rWH4DG_label{color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px}.rp_rWH4DG_chip{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);width:100%;color:var(--dsw-alias-label-secondary);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere;background:0 0;padding:4px 10px;font-size:13px;line-height:20px}.rp_rWH4DG_chip:hover,.rp_rWH4DG_chip:focus-visible{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);outline:none}.rp_rWH4DG_card{border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2);flex-direction:column;gap:2px;padding:6px 10px;display:flex}.rp_rWH4DG_lines{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:16px;font-size:13px;line-height:20px}";
13863
+ const css$1 = ".rp_rWH4DG_dock{box-sizing:border-box;flex-direction:column;align-items:stretch;gap:4px;width:min(800px,100%);min-width:0;margin:0 auto 8px;padding:0 16px;display:flex}.rp_rWH4DG_label{color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px}.rp_rWH4DG_chip{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:var(--dsw-alias-label-secondary);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere;padding:5px 10px;font-size:13px;line-height:20px}.rp_rWH4DG_chip:hover,.rp_rWH4DG_chip:focus-visible{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);outline:none}.rp_rWH4DG_card{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-2);flex-direction:column;gap:2px;padding:6px 10px;display:flex}.rp_rWH4DG_lines{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:16px;font-size:13px;line-height:20px}@media (pointer:coarse){.rp_rWH4DG_chip{min-height:44px}}";
11446
13864
  const key$1 = "src/client/transcript/SuggestionsDock.module.css";
11447
13865
  let tag$1 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$1) + "]");
11448
13866
  if (tag$1 === null) {
@@ -11453,11 +13871,11 @@ window.__ModuleLoader__.load({
11453
13871
  }
11454
13872
  tag$1.textContent = css$1;
11455
13873
  var SuggestionsDock_module_css_default = {
11456
- "card": "rp_rWH4DG_card",
11457
- "chip": "rp_rWH4DG_chip",
11458
13874
  "lines": "rp_rWH4DG_lines",
13875
+ "dock": "rp_rWH4DG_dock",
13876
+ "chip": "rp_rWH4DG_chip",
11459
13877
  "label": "rp_rWH4DG_label",
11460
- "dock": "rp_rWH4DG_dock"
13878
+ "card": "rp_rWH4DG_card"
11461
13879
  };
11462
13880
  //#endregion
11463
13881
  //#region src/client/transcript/SuggestionsDock.tsx
@@ -11514,6 +13932,7 @@ window.__ModuleLoader__.load({
11514
13932
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11515
13933
  className: SuggestionsDock_module_css_default.dock,
11516
13934
  "data-testid": "roleplay-suggestions",
13935
+ "data-rp": "suggestions",
11517
13936
  children: [
11518
13937
  unfinished.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11519
13938
  className: SuggestionsDock_module_css_default.card,
@@ -11544,6 +13963,7 @@ window.__ModuleLoader__.load({
11544
13963
  offered.map((text) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11545
13964
  type: "button",
11546
13965
  className: SuggestionsDock_module_css_default.chip,
13966
+ "data-rp": "suggestion",
11547
13967
  title: t("suggestionHint"),
11548
13968
  onClick: () => {
11549
13969
  pick(text);
@@ -11555,7 +13975,7 @@ window.__ModuleLoader__.load({
11555
13975
  }
11556
13976
  //#endregion
11557
13977
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/transcript/TurnsDock.module.css.mjs
11558
- const css = ".rp_f4YLlq_dock{box-sizing:border-box;width:min(800px,100%);min-width:0;color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0 auto 8px;padding:0 16px;font-size:12px;display:flex}.rp_f4YLlq_group{align-items:center;gap:2px;display:flex}.rp_f4YLlq_button{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;padding:2px 8px;line-height:18px}.rp_f4YLlq_button:hover:not(:disabled),.rp_f4YLlq_button:focus-visible{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);outline:none}.rp_f4YLlq_button:disabled{opacity:.5;cursor:default}.rp_f4YLlq_count{text-align:center;min-width:32px}.rp_f4YLlq_select{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);max-width:220px;color:var(--dsw-alias-label-secondary);font:inherit;background:0 0;padding:2px 4px}.rp_f4YLlq_error{color:var(--dsw-alias-state-error-primary,#d1242f)}";
13978
+ const css = ".rp_f4YLlq_dock{box-sizing:border-box;width:min(800px,100%);min-width:0;color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0 auto 8px;padding:0 16px;font-size:12px;display:flex}.rp_f4YLlq_group{align-items:center;gap:2px;display:flex}.rp_f4YLlq_button{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;padding:2px 10px;line-height:18px}.rp_f4YLlq_button:hover:not(:disabled),.rp_f4YLlq_button:focus-visible{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);outline:none}.rp_f4YLlq_button:disabled{opacity:.5;cursor:default}.rp_f4YLlq_count{text-align:center;min-width:32px}.rp_f4YLlq_select{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);min-width:96px;max-width:220px;min-height:28px;color:var(--dsw-alias-label-secondary);font:inherit;background:0 0;padding:2px 6px}.rp_f4YLlq_error{color:var(--dsw-alias-state-error-primary)}@media (pointer:coarse){.rp_f4YLlq_button,.rp_f4YLlq_select{min-height:44px}}";
11559
13979
  const key = "src/client/transcript/TurnsDock.module.css";
11560
13980
  let tag = document.querySelector("style[data-plugin-css=" + JSON.stringify(key) + "]");
11561
13981
  if (tag === null) {
@@ -11566,12 +13986,12 @@ window.__ModuleLoader__.load({
11566
13986
  }
11567
13987
  tag.textContent = css;
11568
13988
  var TurnsDock_module_css_default = {
11569
- "select": "rp_f4YLlq_select",
11570
- "group": "rp_f4YLlq_group",
11571
- "dock": "rp_f4YLlq_dock",
13989
+ "error": "rp_f4YLlq_error",
11572
13990
  "button": "rp_f4YLlq_button",
13991
+ "dock": "rp_f4YLlq_dock",
13992
+ "group": "rp_f4YLlq_group",
11573
13993
  "count": "rp_f4YLlq_count",
11574
- "error": "rp_f4YLlq_error"
13994
+ "select": "rp_f4YLlq_select"
11575
13995
  };
11576
13996
  //#endregion
11577
13997
  //#region src/client/transcript/withdrawn.ts
@@ -11640,6 +14060,7 @@ window.__ModuleLoader__.load({
11640
14060
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11641
14061
  className: TurnsDock_module_css_default.dock,
11642
14062
  "data-testid": "roleplay-turns",
14063
+ "data-rp": "turns",
11643
14064
  children: [
11644
14065
  style,
11645
14066
  alternatives.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
@@ -11770,6 +14191,7 @@ window.__ModuleLoader__.load({
11770
14191
  swapNext: "The next turn played from the same place",
11771
14192
  oocDone: "Out of character:",
11772
14193
  oocRefused: "Out of character, refused:",
14194
+ oocAnswer: "Out of character, answer:",
11773
14195
  redo: "↷ Forward",
11774
14196
  branch: "⑂ Branch from…",
11775
14197
  after: "After",
@@ -11806,6 +14228,7 @@ window.__ModuleLoader__.load({
11806
14228
  swapNext: "从同一处出发的下一个回合",
11807
14229
  oocDone: "场外:",
11808
14230
  oocRefused: "场外,已拒绝:",
14231
+ oocAnswer: "场外,回答:",
11809
14232
  redo: "↷ 前进",
11810
14233
  branch: "⑂ 分支自…",
11811
14234
  after: "在此之后:",
@@ -11834,30 +14257,12 @@ window.__ModuleLoader__.load({
11834
14257
  //#endregion
11835
14258
  //#region src/client/transcript/index.ts
11836
14259
  const NAMESPACE = "roleplay.transcript";
11837
- /** What can be done with the input box of a session: put words in it, and send them. Resolved on use, so a client without it fails at the click. */
11838
- function facadeOf(scope, sessionId) {
11839
- const input = () => {
11840
- const actx = scope.get("sessions")?.scope(sessionId);
11841
- const conversation = actx?.get("conversation");
11842
- if (actx === void 0 || conversation === void 0) throw new Error("the input of this chat is not available");
11843
- return conversation.input.for(actx);
11844
- };
11845
- return {
11846
- pick: (text) => {
11847
- input().setDraft(text);
11848
- },
11849
- fill: (text, send) => {
11850
- const facade = input();
11851
- facade.setDraft(text);
11852
- if (send) facade.submit();
11853
- }
11854
- };
11855
- }
11856
14260
  /** The turns of a roleplay session, as the host keeps them. */
11857
14261
  async function timelineOf(chat) {
11858
14262
  const id = roleplaySessionOf(chat);
11859
14263
  if (id === void 0) throw new Error("this chat is not a roleplay session");
11860
14264
  const response = await fetch(`roleplay-api/sessions/timeline?id=${encodeURIComponent(id)}`);
14265
+ if (response.status === 404) return void 0;
11861
14266
  if (!response.ok) throw new Error(`the turns could not be read (${response.status})`);
11862
14267
  const view = await response.json();
11863
14268
  return {
@@ -11953,6 +14358,7 @@ window.__ModuleLoader__.load({
11953
14358
  registerChatSettings(ctx);
11954
14359
  registerWorld(ctx);
11955
14360
  registerGallery(ctx);
14361
+ registerInterface(ctx);
11956
14362
  registerBranchNaming(ctx);
11957
14363
  }
11958
14364
  //#endregion