@dsh-agentic-roleplay/core 0.2.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.
- package/lib/{chat-AKrVcWIC.js → access-EbNdZFbk.js} +10 -2
- package/lib/authoring.js +178 -7
- package/lib/client.js +2353 -1390
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -3
- package/lib/{activity-t7OBgHlc.js → deliver--uMhC6oO.js} +505 -13
- package/lib/{documents-Bu5uYRZB.js → documents-7GMc5NnW.js} +107 -4
- package/lib/images.js +1 -1
- package/lib/index.js +243 -17
- package/lib/{narration-BRyHU0H2.js → narration-CKZTk5UE.js} +10 -1
- package/lib/orchestration.js +99 -75
- package/lib/{packs-ByP1J-zj.js → packs-alJTiDM2.js} +4 -2
- package/lib/{presenter-agent-G43ODV8I.js → presenter-agent-PX1WVaJB.js} +2 -2
- package/package.json +3 -2
- package/packs/scene/map.html +12 -0
- package/packs/scene/map.js +55 -0
- package/packs/scene/pack.json +11 -0
- package/packs/scene/strip.html +11 -0
- package/packs/scene/strip.js +26 -0
- package/packs/scene/style.css +16 -0
- package/prompts/en/roleplay/reflection.md +9 -0
- package/prompts/en/world/procedure.md +1 -1
- package/prompts/en/world/welcome.md +1 -1
- package/prompts/zh/roleplay/reflection.md +9 -0
- package/prompts/zh/world/procedure.md +1 -1
- package/prompts/zh/world/welcome.md +1 -1
- package/lib/access-C1nFQiyT.js +0 -12
package/lib/client.js
CHANGED
|
@@ -26,16 +26,16 @@ window.__ModuleLoader__.load({
|
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/PageTabs.module.css.mjs
|
|
29
|
-
const css$
|
|
30
|
-
const key$
|
|
31
|
-
let tag$
|
|
32
|
-
if (tag$
|
|
33
|
-
tag$
|
|
34
|
-
tag$
|
|
35
|
-
tag$
|
|
36
|
-
document.head.appendChild(tag$
|
|
37
|
-
}
|
|
38
|
-
tag$
|
|
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;
|
|
39
39
|
var PageTabs_module_css_default = {
|
|
40
40
|
"tabs": "rp_Poldga_tabs",
|
|
41
41
|
"tab": "rp_Poldga_tab"
|
|
@@ -82,21 +82,21 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/RoleplayPanel.module.css.mjs
|
|
85
|
-
const css$
|
|
86
|
-
const key$
|
|
87
|
-
let tag$
|
|
88
|
-
if (tag$
|
|
89
|
-
tag$
|
|
90
|
-
tag$
|
|
91
|
-
tag$
|
|
92
|
-
document.head.appendChild(tag$
|
|
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
93
|
}
|
|
94
|
-
tag$
|
|
94
|
+
tag$23.textContent = css$23;
|
|
95
95
|
var RoleplayPanel_module_css_default = {
|
|
96
96
|
"panel": "rp_ua5gBa_panel",
|
|
97
|
+
"body": "rp_ua5gBa_body",
|
|
97
98
|
"title": "rp_ua5gBa_title",
|
|
98
|
-
"header": "rp_ua5gBa_header"
|
|
99
|
-
"body": "rp_ua5gBa_body"
|
|
99
|
+
"header": "rp_ua5gBa_header"
|
|
100
100
|
};
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/client/panel/RoleplayPanel.tsx
|
|
@@ -143,7 +143,7 @@ window.__ModuleLoader__.load({
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/client/panel/locales.ts
|
|
146
|
-
const dictionaries$
|
|
146
|
+
const dictionaries$13 = {
|
|
147
147
|
en: {
|
|
148
148
|
label: "Role Play",
|
|
149
149
|
heading: "DSH Agentic Role Play",
|
|
@@ -204,7 +204,7 @@ window.__ModuleLoader__.load({
|
|
|
204
204
|
/** Adds the Role Play entry to the sidebar and the main panel it opens. */
|
|
205
205
|
function registerPanel(ctx) {
|
|
206
206
|
const t = ctx.locale.bind(NAMESPACE$10);
|
|
207
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$
|
|
207
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$13), "roleplay: panel dictionaries");
|
|
208
208
|
const pages = createPagesSource(ctx);
|
|
209
209
|
ctx.effect(() => pages.start(), "roleplay: page list");
|
|
210
210
|
const handle = createPanelStore();
|
|
@@ -734,53 +734,100 @@ window.__ModuleLoader__.load({
|
|
|
734
734
|
const isDirty = (character, draft) => Object.keys(editOf$1(character, draft)).length > 0;
|
|
735
735
|
//#endregion
|
|
736
736
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/CharactersPanel.module.css.mjs
|
|
737
|
-
const css$
|
|
738
|
-
const key$
|
|
739
|
-
let tag$
|
|
740
|
-
if (tag$
|
|
741
|
-
tag$
|
|
742
|
-
tag$
|
|
743
|
-
tag$
|
|
744
|
-
document.head.appendChild(tag$
|
|
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
745
|
}
|
|
746
|
-
tag$
|
|
746
|
+
tag$22.textContent = css$22;
|
|
747
747
|
var CharactersPanel_module_css_default = {
|
|
748
|
-
"
|
|
749
|
-
"
|
|
750
|
-
"
|
|
751
|
-
"
|
|
748
|
+
"help": "rp_5ZMIxq_help",
|
|
749
|
+
"field": "rp_5ZMIxq_field",
|
|
750
|
+
"portraitBox": "rp_5ZMIxq_portraitBox",
|
|
751
|
+
"area": "rp_5ZMIxq_area",
|
|
752
752
|
"placeholder": "rp_5ZMIxq_placeholder",
|
|
753
|
-
"
|
|
753
|
+
"bar": "rp_5ZMIxq_bar",
|
|
754
|
+
"tabs": "rp_5ZMIxq_tabs",
|
|
754
755
|
"meta": "rp_5ZMIxq_meta",
|
|
755
|
-
"
|
|
756
|
-
"barText": "rp_5ZMIxq_barText",
|
|
757
|
-
"portraitAction": "rp_5ZMIxq_portraitAction",
|
|
756
|
+
"error": "rp_5ZMIxq_error",
|
|
758
757
|
"initial": "rp_5ZMIxq_initial",
|
|
758
|
+
"nameInput": "rp_5ZMIxq_nameInput",
|
|
759
|
+
"row": "rp_5ZMIxq_row",
|
|
760
|
+
"portrait": "rp_5ZMIxq_portrait",
|
|
759
761
|
"missing": "rp_5ZMIxq_missing",
|
|
762
|
+
"empty": "rp_5ZMIxq_empty",
|
|
763
|
+
"body": "rp_5ZMIxq_body",
|
|
760
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",
|
|
761
769
|
"voiceInline": "rp_5ZMIxq_voiceInline",
|
|
762
|
-
"
|
|
770
|
+
"barText": "rp_5ZMIxq_barText",
|
|
771
|
+
"portraitError": "rp_5ZMIxq_portraitError",
|
|
763
772
|
"grid": "rp_5ZMIxq_grid",
|
|
764
|
-
"portrait": "rp_5ZMIxq_portrait",
|
|
765
|
-
"empty": "rp_5ZMIxq_empty",
|
|
766
|
-
"portraitBox": "rp_5ZMIxq_portraitBox",
|
|
767
|
-
"bar": "rp_5ZMIxq_bar",
|
|
768
|
-
"field": "rp_5ZMIxq_field",
|
|
769
|
-
"label": "rp_5ZMIxq_label",
|
|
770
|
-
"sectionTitle": "rp_5ZMIxq_sectionTitle",
|
|
771
|
-
"help": "rp_5ZMIxq_help",
|
|
772
|
-
"select": "rp_5ZMIxq_select",
|
|
773
|
-
"nameInput": "rp_5ZMIxq_nameInput",
|
|
774
|
-
"row": "rp_5ZMIxq_row",
|
|
775
|
-
"error": "rp_5ZMIxq_error",
|
|
776
|
-
"area": "rp_5ZMIxq_area",
|
|
777
773
|
"wide": "rp_5ZMIxq_wide",
|
|
778
|
-
"
|
|
779
|
-
"
|
|
774
|
+
"sheet": "rp_5ZMIxq_sheet",
|
|
775
|
+
"portraitAction": "rp_5ZMIxq_portraitAction",
|
|
776
|
+
"label": "rp_5ZMIxq_label",
|
|
777
|
+
"tabOn": "rp_5ZMIxq_tabOn",
|
|
778
|
+
"panel": "rp_5ZMIxq_panel",
|
|
780
779
|
"tab": "rp_5ZMIxq_tab",
|
|
781
|
-
"
|
|
780
|
+
"portraitHint": "rp_5ZMIxq_portraitHint",
|
|
781
|
+
"goal": "rp_5ZMIxq_goal"
|
|
782
782
|
};
|
|
783
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
|
|
784
831
|
//#region src/client/world-editor/CharactersPanel.tsx
|
|
785
832
|
/** A steady colour per name, for a portrait that does not exist yet. */
|
|
786
833
|
function hueOf$3(name) {
|
|
@@ -800,7 +847,9 @@ window.__ModuleLoader__.load({
|
|
|
800
847
|
children: [character.portrait !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
801
848
|
className: CharactersPanel_module_css_default.portrait,
|
|
802
849
|
src: character.portrait,
|
|
803
|
-
alt: ""
|
|
850
|
+
alt: "",
|
|
851
|
+
loading: "lazy",
|
|
852
|
+
decoding: "async"
|
|
804
853
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
805
854
|
className: `${CharactersPanel_module_css_default.portrait} ${CharactersPanel_module_css_default.placeholder}`,
|
|
806
855
|
style: { background: `hsl(${hueOf$3(character.name)} 22% 88%)` },
|
|
@@ -1328,11 +1377,13 @@ window.__ModuleLoader__.load({
|
|
|
1328
1377
|
className: CharactersPanel_module_css_default.tabs,
|
|
1329
1378
|
role: "tablist",
|
|
1330
1379
|
"aria-label": t("characters"),
|
|
1380
|
+
onKeyDown: navigateEditorTabs,
|
|
1331
1381
|
children: [
|
|
1332
1382
|
world.characters.map((character) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1333
1383
|
type: "button",
|
|
1334
1384
|
role: "tab",
|
|
1335
1385
|
"aria-selected": character.key === current.key,
|
|
1386
|
+
tabIndex: character.key === current.key ? 0 : -1,
|
|
1336
1387
|
className: `${CharactersPanel_module_css_default.tab} ${character.key === current.key ? CharactersPanel_module_css_default.tabOn : ""}`,
|
|
1337
1388
|
onClick: () => {
|
|
1338
1389
|
setChosen(character.key);
|
|
@@ -1454,23 +1505,15 @@ window.__ModuleLoader__.load({
|
|
|
1454
1505
|
...globalId.trim() === "" ? {} : { globalId: globalId.trim() }
|
|
1455
1506
|
};
|
|
1456
1507
|
function Tabs({ entries, chosen, choose, actions }) {
|
|
1457
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
onClick: () => {
|
|
1467
|
-
choose(entry.key);
|
|
1468
|
-
},
|
|
1469
|
-
children: entry.name
|
|
1470
|
-
}, entry.key)),
|
|
1471
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: CharactersPanel_module_css_default.tabsSpace }),
|
|
1472
|
-
actions
|
|
1473
|
-
]
|
|
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]
|
|
1474
1517
|
});
|
|
1475
1518
|
}
|
|
1476
1519
|
function SaveBar({ t, dirty, status, save, reset }) {
|
|
@@ -2336,50 +2379,50 @@ window.__ModuleLoader__.load({
|
|
|
2336
2379
|
}
|
|
2337
2380
|
//#endregion
|
|
2338
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
|
|
2339
|
-
const css$
|
|
2340
|
-
const key$
|
|
2341
|
-
let tag$
|
|
2342
|
-
if (tag$
|
|
2343
|
-
tag$
|
|
2344
|
-
tag$
|
|
2345
|
-
tag$
|
|
2346
|
-
document.head.appendChild(tag$
|
|
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);
|
|
2347
2390
|
}
|
|
2348
|
-
tag$
|
|
2391
|
+
tag$21.textContent = css$21;
|
|
2349
2392
|
var RelationsPanel_module_css_default = {
|
|
2350
|
-
"
|
|
2351
|
-
"
|
|
2352
|
-
"
|
|
2353
|
-
"
|
|
2393
|
+
"filter": "rp_7pEHTW_filter",
|
|
2394
|
+
"check": "rp_7pEHTW_check",
|
|
2395
|
+
"head": "rp_7pEHTW_head",
|
|
2396
|
+
"graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
|
|
2354
2397
|
"graph": "rp_7pEHTW_graph",
|
|
2355
|
-
"
|
|
2356
|
-
"
|
|
2357
|
-
"
|
|
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",
|
|
2358
2403
|
"graphInspector": "rp_7pEHTW_graphInspector",
|
|
2359
2404
|
"node_location": "rp_7pEHTW_node_location",
|
|
2360
|
-
"
|
|
2361
|
-
"
|
|
2362
|
-
"
|
|
2363
|
-
"
|
|
2364
|
-
"
|
|
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",
|
|
2411
|
+
"node": "rp_7pEHTW_node",
|
|
2412
|
+
"entities": "rp_7pEHTW_entities",
|
|
2365
2413
|
"graphEdge": "rp_7pEHTW_graphEdge",
|
|
2366
|
-
"
|
|
2414
|
+
"edgeTitle": "rp_7pEHTW_edgeTitle",
|
|
2415
|
+
"metrics": "rp_7pEHTW_metrics",
|
|
2416
|
+
"perspective": "rp_7pEHTW_perspective",
|
|
2417
|
+
"panel": "rp_7pEHTW_panel",
|
|
2367
2418
|
"edge": "rp_7pEHTW_edge",
|
|
2368
2419
|
"edgeOn": "rp_7pEHTW_edgeOn",
|
|
2369
|
-
"
|
|
2370
|
-
"node": "rp_7pEHTW_node",
|
|
2371
|
-
"notice": "rp_7pEHTW_notice",
|
|
2372
|
-
"wide": "rp_7pEHTW_wide",
|
|
2373
|
-
"perspective": "rp_7pEHTW_perspective",
|
|
2374
|
-
"actions": "rp_7pEHTW_actions",
|
|
2375
|
-
"graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
|
|
2420
|
+
"edgeKind": "rp_7pEHTW_edgeKind",
|
|
2376
2421
|
"form": "rp_7pEHTW_form",
|
|
2377
2422
|
"inspector": "rp_7pEHTW_inspector",
|
|
2378
|
-
"
|
|
2379
|
-
"
|
|
2380
|
-
"
|
|
2381
|
-
"metrics": "rp_7pEHTW_metrics",
|
|
2382
|
-
"check": "rp_7pEHTW_check"
|
|
2423
|
+
"node_character": "rp_7pEHTW_node_character",
|
|
2424
|
+
"status": "rp_7pEHTW_status",
|
|
2425
|
+
"wide": "rp_7pEHTW_wide"
|
|
2383
2426
|
};
|
|
2384
2427
|
//#endregion
|
|
2385
2428
|
//#region src/client/world-editor/RelationsPanel.tsx
|
|
@@ -3503,61 +3546,921 @@ window.__ModuleLoader__.load({
|
|
|
3503
3546
|
});
|
|
3504
3547
|
}
|
|
3505
3548
|
//#endregion
|
|
3506
|
-
//#region src/
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
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
|
|
3523
3575
|
}
|
|
3524
|
-
});
|
|
3525
|
-
const loadInfo = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("GET", signal)));
|
|
3526
|
-
const saveInfo = async (world, edit, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/info?${query(world)}`, init("PUT", signal, edit)));
|
|
3527
|
-
const loadPrompts = async (world, language, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/prompts?${query(world, language)}`, init("GET", signal)));
|
|
3528
|
-
const loadPrompt = async (world, language, prompt, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("GET", signal)));
|
|
3529
|
-
const savePrompt = async (world, language, prompt, text, signal) => {
|
|
3530
|
-
await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("PUT", signal, { text })));
|
|
3531
3576
|
};
|
|
3532
|
-
const
|
|
3533
|
-
|
|
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
|
+
}
|
|
3534
3588
|
};
|
|
3535
|
-
const loadRoutines = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/routines?${query(world)}`, init("GET", signal)));
|
|
3536
|
-
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 })));
|
|
3537
|
-
const loadVariables = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("GET", signal)));
|
|
3538
|
-
const saveVariables = async (world, variables, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("PUT", signal, { variables })));
|
|
3539
3589
|
//#endregion
|
|
3540
|
-
//#region src/client/
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
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
|
|
3553
3615
|
});
|
|
3554
|
-
|
|
3555
|
-
const
|
|
3556
|
-
/** The
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
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
|
|
3951
|
+
//#region src/client/world-editor/world-files-api.ts
|
|
3952
|
+
async function read$2(response) {
|
|
3953
|
+
if (!response.ok) {
|
|
3954
|
+
const body = await response.json().catch(() => void 0);
|
|
3955
|
+
const message = (Array.isArray(body?.problems) ? body.problems.join("; ") : void 0) ?? (typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
|
|
3956
|
+
throw response.status === 422 ? new RefusedEditError(message) : new Error(message);
|
|
3957
|
+
}
|
|
3958
|
+
return await response.json();
|
|
3959
|
+
}
|
|
3960
|
+
const query = (world, language, prompt) => `id=${encodeURIComponent(world)}${language === void 0 ? "" : `&language=${encodeURIComponent(language)}`}${prompt === void 0 ? "" : `&prompt=${encodeURIComponent(prompt)}`}`;
|
|
3961
|
+
const init = (method, signal, body) => ({
|
|
3962
|
+
method,
|
|
3963
|
+
credentials: "same-origin",
|
|
3964
|
+
signal,
|
|
3965
|
+
...body === void 0 ? {} : {
|
|
3966
|
+
headers: { "content-type": "application/json" },
|
|
3967
|
+
body: JSON.stringify(body)
|
|
3968
|
+
}
|
|
3969
|
+
});
|
|
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)));
|
|
3974
|
+
const savePrompt = async (world, language, prompt, text, signal) => {
|
|
3975
|
+
await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("PUT", signal, { text })));
|
|
3976
|
+
};
|
|
3977
|
+
const removePrompt = async (world, language, prompt, signal) => {
|
|
3978
|
+
await read$2(await fetch(`${API_PREFIX}/worlds/prompts/item?${query(world, language, prompt)}`, init("DELETE", signal)));
|
|
3979
|
+
};
|
|
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)));
|
|
3986
|
+
//#endregion
|
|
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,
|
|
4452
|
+
timeZone: info.timeZone,
|
|
4453
|
+
startingTime: info.startingTime,
|
|
4454
|
+
version: info.version,
|
|
4455
|
+
alternates: info.alternateOpenings
|
|
4456
|
+
});
|
|
4457
|
+
const lines = (value) => value.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
4458
|
+
const words = (value) => value.split(/[,,]/).map((tag) => tag.trim()).filter((tag) => tag !== "");
|
|
4459
|
+
/** The edit that turns the saved fields into the drafted ones: only what changed. */
|
|
4460
|
+
function changes(saved, draft) {
|
|
4461
|
+
const edit = {};
|
|
4462
|
+
for (const key of [
|
|
4463
|
+
"name",
|
|
3561
4464
|
"description",
|
|
3562
4465
|
"opening",
|
|
3563
4466
|
"authorName",
|
|
@@ -4084,11 +4987,14 @@ window.__ModuleLoader__.load({
|
|
|
4084
4987
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4085
4988
|
className: CharactersPanel_module_css_default.tabs,
|
|
4086
4989
|
role: "tablist",
|
|
4990
|
+
"aria-label": t("characters"),
|
|
4991
|
+
onKeyDown: navigateEditorTabs,
|
|
4087
4992
|
children: [
|
|
4088
4993
|
world.characters.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4089
4994
|
type: "button",
|
|
4090
4995
|
role: "tab",
|
|
4091
4996
|
"aria-selected": entry.key === character.key,
|
|
4997
|
+
tabIndex: entry.key === character.key ? 0 : -1,
|
|
4092
4998
|
className: `${CharactersPanel_module_css_default.tab} ${entry.key === character.key ? CharactersPanel_module_css_default.tabOn : ""}`,
|
|
4093
4999
|
onClick: () => {
|
|
4094
5000
|
setChosen(entry.key);
|
|
@@ -4687,7 +5593,9 @@ window.__ModuleLoader__.load({
|
|
|
4687
5593
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
4688
5594
|
className,
|
|
4689
5595
|
src,
|
|
4690
|
-
alt
|
|
5596
|
+
alt,
|
|
5597
|
+
loading: "lazy",
|
|
5598
|
+
decoding: "async"
|
|
4691
5599
|
})
|
|
4692
5600
|
})
|
|
4693
5601
|
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ImageLightbox, {
|
|
@@ -4746,51 +5654,51 @@ window.__ModuleLoader__.load({
|
|
|
4746
5654
|
const imageUrl = (target, image) => `${route(target, "/file")}&path=${encodeURIComponent(image.path)}&v=${encodeURIComponent(image.createdAt)}`;
|
|
4747
5655
|
//#endregion
|
|
4748
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
|
|
4749
|
-
const css$
|
|
4750
|
-
const key$
|
|
4751
|
-
let tag$
|
|
4752
|
-
if (tag$
|
|
4753
|
-
tag$
|
|
4754
|
-
tag$
|
|
4755
|
-
tag$
|
|
4756
|
-
document.head.appendChild(tag$
|
|
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);
|
|
4757
5665
|
}
|
|
4758
|
-
tag$
|
|
5666
|
+
tag$18.textContent = css$18;
|
|
4759
5667
|
var GalleryView_module_css_default = {
|
|
4760
|
-
"
|
|
5668
|
+
"caption": "rp_9pSHmG_caption",
|
|
5669
|
+
"thumb": "rp_9pSHmG_thumb",
|
|
5670
|
+
"message": "rp_9pSHmG_message",
|
|
5671
|
+
"editField": "rp_9pSHmG_editField",
|
|
5672
|
+
"facts": "rp_9pSHmG_facts",
|
|
5673
|
+
"editArea": "rp_9pSHmG_editArea",
|
|
4761
5674
|
"editInput": "rp_9pSHmG_editInput",
|
|
5675
|
+
"editHelp": "rp_9pSHmG_editHelp",
|
|
5676
|
+
"status": "rp_9pSHmG_status",
|
|
5677
|
+
"reusable": "rp_9pSHmG_reusable",
|
|
4762
5678
|
"editButton": "rp_9pSHmG_editButton",
|
|
4763
|
-
"
|
|
4764
|
-
"
|
|
5679
|
+
"page": "rp_9pSHmG_page",
|
|
5680
|
+
"pre": "rp_9pSHmG_pre",
|
|
5681
|
+
"actions": "rp_9pSHmG_actions",
|
|
4765
5682
|
"error": "rp_9pSHmG_error",
|
|
4766
5683
|
"toolbar": "rp_9pSHmG_toolbar",
|
|
4767
|
-
"
|
|
4768
|
-
"page": "rp_9pSHmG_page",
|
|
4769
|
-
"editLabel": "rp_9pSHmG_editLabel",
|
|
4770
|
-
"editArea": "rp_9pSHmG_editArea",
|
|
4771
|
-
"facts": "rp_9pSHmG_facts",
|
|
4772
|
-
"statusError": "rp_9pSHmG_statusError",
|
|
5684
|
+
"open": "rp_9pSHmG_open",
|
|
4773
5685
|
"tags": "rp_9pSHmG_tags",
|
|
4774
|
-
"
|
|
4775
|
-
"thumb": "rp_9pSHmG_thumb",
|
|
5686
|
+
"note": "rp_9pSHmG_note",
|
|
4776
5687
|
"large": "rp_9pSHmG_large",
|
|
4777
|
-
"
|
|
4778
|
-
"
|
|
4779
|
-
"
|
|
4780
|
-
"actions": "rp_9pSHmG_actions",
|
|
4781
|
-
"message": "rp_9pSHmG_message",
|
|
4782
|
-
"grid": "rp_9pSHmG_grid",
|
|
5688
|
+
"count": "rp_9pSHmG_count",
|
|
5689
|
+
"image": "rp_9pSHmG_image",
|
|
5690
|
+
"select": "rp_9pSHmG_select",
|
|
4783
5691
|
"edit": "rp_9pSHmG_edit",
|
|
4784
|
-
"
|
|
4785
|
-
"
|
|
4786
|
-
"
|
|
4787
|
-
"
|
|
4788
|
-
"
|
|
5692
|
+
"statusError": "rp_9pSHmG_statusError",
|
|
5693
|
+
"editLabel": "rp_9pSHmG_editLabel",
|
|
5694
|
+
"grid": "rp_9pSHmG_grid",
|
|
5695
|
+
"detail": "rp_9pSHmG_detail",
|
|
5696
|
+
"cell": "rp_9pSHmG_cell"
|
|
4789
5697
|
};
|
|
4790
5698
|
//#endregion
|
|
4791
5699
|
//#region src/client/widgets/gallery-view/GalleryView.tsx
|
|
4792
5700
|
/** How often the list is read again while pictures are waiting to be described. */
|
|
4793
|
-
const POLL_MS$
|
|
5701
|
+
const POLL_MS$2 = 3e3;
|
|
4794
5702
|
const messageOf$1 = (error) => error instanceof Error ? error.message : String(error);
|
|
4795
5703
|
function EditDialog({ t, image, onSave, onClose }) {
|
|
4796
5704
|
const [description, setDescription] = (0, react.useState)(image.description ?? "");
|
|
@@ -4911,7 +5819,7 @@ window.__ModuleLoader__.load({
|
|
|
4911
5819
|
const abort = new AbortController();
|
|
4912
5820
|
const timer = window.setTimeout(() => {
|
|
4913
5821
|
read(abort.signal);
|
|
4914
|
-
}, POLL_MS$
|
|
5822
|
+
}, POLL_MS$2);
|
|
4915
5823
|
return () => {
|
|
4916
5824
|
window.clearTimeout(timer);
|
|
4917
5825
|
abort.abort();
|
|
@@ -5115,24 +6023,24 @@ window.__ModuleLoader__.load({
|
|
|
5115
6023
|
}
|
|
5116
6024
|
//#endregion
|
|
5117
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
|
|
5118
|
-
const css$
|
|
5119
|
-
const key$
|
|
5120
|
-
let tag$
|
|
5121
|
-
if (tag$
|
|
5122
|
-
tag$
|
|
5123
|
-
tag$
|
|
5124
|
-
tag$
|
|
5125
|
-
document.head.appendChild(tag$
|
|
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);
|
|
5126
6034
|
}
|
|
5127
|
-
tag$
|
|
6035
|
+
tag$17.textContent = css$17;
|
|
5128
6036
|
var WorldEditor_module_css_default = {
|
|
5129
|
-
"
|
|
5130
|
-
"warning": "rp__swA3a_warning",
|
|
5131
|
-
"message": "rp__swA3a_message",
|
|
6037
|
+
"view": "rp__swA3a_view",
|
|
5132
6038
|
"drawer": "rp__swA3a_drawer",
|
|
6039
|
+
"drawerItemOn": "rp__swA3a_drawerItemOn",
|
|
6040
|
+
"drawerItem": "rp__swA3a_drawerItem",
|
|
5133
6041
|
"content": "rp__swA3a_content",
|
|
5134
|
-
"
|
|
5135
|
-
"
|
|
6042
|
+
"warning": "rp__swA3a_warning",
|
|
6043
|
+
"message": "rp__swA3a_message"
|
|
5136
6044
|
};
|
|
5137
6045
|
//#endregion
|
|
5138
6046
|
//#region src/client/world-editor/WorldEditor.tsx
|
|
@@ -5173,6 +6081,11 @@ window.__ModuleLoader__.load({
|
|
|
5173
6081
|
label: "plots",
|
|
5174
6082
|
built: true
|
|
5175
6083
|
},
|
|
6084
|
+
{
|
|
6085
|
+
id: "triggers",
|
|
6086
|
+
label: "trig_title",
|
|
6087
|
+
built: true
|
|
6088
|
+
},
|
|
5176
6089
|
{
|
|
5177
6090
|
id: "relations",
|
|
5178
6091
|
label: "relationships",
|
|
@@ -5196,6 +6109,12 @@ window.__ModuleLoader__.load({
|
|
|
5196
6109
|
built: true,
|
|
5197
6110
|
ownFiles: true
|
|
5198
6111
|
},
|
|
6112
|
+
{
|
|
6113
|
+
id: "interface",
|
|
6114
|
+
label: "pk_title",
|
|
6115
|
+
built: true,
|
|
6116
|
+
ownFiles: true
|
|
6117
|
+
},
|
|
5199
6118
|
{
|
|
5200
6119
|
id: "images",
|
|
5201
6120
|
label: "sectionImages",
|
|
@@ -5256,6 +6175,7 @@ window.__ModuleLoader__.load({
|
|
|
5256
6175
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5257
6176
|
className: WorldEditor_module_css_default.view,
|
|
5258
6177
|
"data-testid": "roleplay-world",
|
|
6178
|
+
onKeyDownCapture: navigateEditorTabs,
|
|
5259
6179
|
children: [sections.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
5260
6180
|
className: WorldEditor_module_css_default.drawer,
|
|
5261
6181
|
"aria-label": t("sections"),
|
|
@@ -5325,6 +6245,17 @@ window.__ModuleLoader__.load({
|
|
|
5325
6245
|
children: t("editorRefresh")
|
|
5326
6246
|
})
|
|
5327
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
|
+
}),
|
|
5328
6259
|
section === "images" && source.worldId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GalleryView, {
|
|
5329
6260
|
t: galleryText,
|
|
5330
6261
|
target: {
|
|
@@ -5411,6 +6342,17 @@ window.__ModuleLoader__.load({
|
|
|
5411
6342
|
children: t("editorRefresh")
|
|
5412
6343
|
})
|
|
5413
6344
|
}),
|
|
6345
|
+
section === "triggers" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriggersPanel, {
|
|
6346
|
+
t,
|
|
6347
|
+
world: load.world,
|
|
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
|
+
}),
|
|
5414
6356
|
section === "relations" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RelationsPanel, {
|
|
5415
6357
|
t,
|
|
5416
6358
|
world: load.world,
|
|
@@ -5428,40 +6370,40 @@ window.__ModuleLoader__.load({
|
|
|
5428
6370
|
})]
|
|
5429
6371
|
});
|
|
5430
6372
|
}
|
|
5431
|
-
//#endregion
|
|
5432
|
-
//#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
|
|
5433
|
-
const css$
|
|
5434
|
-
const key$
|
|
5435
|
-
let tag$
|
|
5436
|
-
if (tag$
|
|
5437
|
-
tag$
|
|
5438
|
-
tag$
|
|
5439
|
-
tag$
|
|
5440
|
-
document.head.appendChild(tag$
|
|
5441
|
-
}
|
|
5442
|
-
tag$
|
|
6373
|
+
//#endregion
|
|
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
|
|
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);
|
|
6383
|
+
}
|
|
6384
|
+
tag$16.textContent = css$16;
|
|
5443
6385
|
var AvatarsPage_module_css_default = {
|
|
6386
|
+
"text": "rp_pQOzEG_text",
|
|
6387
|
+
"open": "rp_pQOzEG_open",
|
|
6388
|
+
"portrait": "rp_pQOzEG_portrait",
|
|
6389
|
+
"form": "rp_pQOzEG_form",
|
|
5444
6390
|
"field": "rp_pQOzEG_field",
|
|
5445
|
-
"
|
|
6391
|
+
"name": "rp_pQOzEG_name",
|
|
6392
|
+
"message": "rp_pQOzEG_message",
|
|
5446
6393
|
"toolbar": "rp_pQOzEG_toolbar",
|
|
6394
|
+
"label": "rp_pQOzEG_label",
|
|
6395
|
+
"editBody": "rp_pQOzEG_editBody",
|
|
5447
6396
|
"viewport": "rp_pQOzEG_viewport",
|
|
6397
|
+
"grid": "rp_pQOzEG_grid",
|
|
5448
6398
|
"placeholder": "rp_pQOzEG_placeholder",
|
|
5449
|
-
"
|
|
5450
|
-
"
|
|
5451
|
-
"form": "rp_pQOzEG_form",
|
|
6399
|
+
"count": "rp_pQOzEG_count",
|
|
6400
|
+
"actions": "rp_pQOzEG_actions",
|
|
5452
6401
|
"card": "rp_pQOzEG_card",
|
|
5453
6402
|
"error": "rp_pQOzEG_error",
|
|
5454
|
-
"
|
|
5455
|
-
"
|
|
5456
|
-
"name": "rp_pQOzEG_name",
|
|
5457
|
-
"grid": "rp_pQOzEG_grid",
|
|
5458
|
-
"portrait": "rp_pQOzEG_portrait",
|
|
5459
|
-
"open": "rp_pQOzEG_open",
|
|
5460
|
-
"text": "rp_pQOzEG_text",
|
|
5461
|
-
"count": "rp_pQOzEG_count",
|
|
5462
|
-
"label": "rp_pQOzEG_label",
|
|
6403
|
+
"page": "rp_pQOzEG_page",
|
|
6404
|
+
"editHeader": "rp_pQOzEG_editHeader",
|
|
5463
6405
|
"editTitle": "rp_pQOzEG_editTitle",
|
|
5464
|
-
"
|
|
6406
|
+
"summary": "rp_pQOzEG_summary"
|
|
5465
6407
|
};
|
|
5466
6408
|
//#endregion
|
|
5467
6409
|
//#region src/client/pages/avatars/AvatarsPage.tsx
|
|
@@ -5482,7 +6424,9 @@ window.__ModuleLoader__.load({
|
|
|
5482
6424
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
5483
6425
|
className: AvatarsPage_module_css_default.portrait,
|
|
5484
6426
|
src: avatar.portrait,
|
|
5485
|
-
alt: ""
|
|
6427
|
+
alt: "",
|
|
6428
|
+
loading: "lazy",
|
|
6429
|
+
decoding: "async"
|
|
5486
6430
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
5487
6431
|
className: AvatarsPage_module_css_default.text,
|
|
5488
6432
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -5742,7 +6686,7 @@ window.__ModuleLoader__.load({
|
|
|
5742
6686
|
}
|
|
5743
6687
|
//#endregion
|
|
5744
6688
|
//#region src/client/widgets/gallery-view/locales.ts
|
|
5745
|
-
const dictionaries$
|
|
6689
|
+
const dictionaries$12 = {
|
|
5746
6690
|
en: {
|
|
5747
6691
|
tab: "Gallery",
|
|
5748
6692
|
notRoleplay: "This chat is not a roleplay session, so it has no gallery.",
|
|
@@ -5820,7 +6764,7 @@ window.__ModuleLoader__.load({
|
|
|
5820
6764
|
cancel: "取消"
|
|
5821
6765
|
}
|
|
5822
6766
|
};
|
|
5823
|
-
const dictionaries$9 = withDictionaries({
|
|
6767
|
+
const dictionaries$9 = withDictionaries(withDictionaries(withDictionaries({
|
|
5824
6768
|
en: {
|
|
5825
6769
|
language: "en",
|
|
5826
6770
|
sectionInfo: "About",
|
|
@@ -6337,7 +7281,183 @@ window.__ModuleLoader__.load({
|
|
|
6337
7281
|
relationCancel: "取消",
|
|
6338
7282
|
relationCreate: "创建"
|
|
6339
7283
|
}
|
|
6340
|
-
}, prefixed(dictionaries$
|
|
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_"));
|
|
6341
7461
|
const dictionaries$8 = withDictionaries({
|
|
6342
7462
|
en: {
|
|
6343
7463
|
nav: "Avatars",
|
|
@@ -6442,16 +7562,16 @@ window.__ModuleLoader__.load({
|
|
|
6442
7562
|
}
|
|
6443
7563
|
//#endregion
|
|
6444
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
|
|
6445
|
-
const css$
|
|
6446
|
-
const key$
|
|
6447
|
-
let tag$
|
|
6448
|
-
if (tag$
|
|
6449
|
-
tag$
|
|
6450
|
-
tag$
|
|
6451
|
-
tag$
|
|
6452
|
-
document.head.appendChild(tag$
|
|
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);
|
|
6453
7573
|
}
|
|
6454
|
-
tag$
|
|
7574
|
+
tag$15.textContent = css$15;
|
|
6455
7575
|
var Pager_module_css_default = {
|
|
6456
7576
|
"position": "rp_KBAD0W_position",
|
|
6457
7577
|
"pager": "rp_KBAD0W_pager"
|
|
@@ -6489,16 +7609,16 @@ window.__ModuleLoader__.load({
|
|
|
6489
7609
|
}
|
|
6490
7610
|
//#endregion
|
|
6491
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
|
|
6492
|
-
const css$
|
|
6493
|
-
const key$
|
|
6494
|
-
let tag$
|
|
6495
|
-
if (tag$
|
|
6496
|
-
tag$
|
|
6497
|
-
tag$
|
|
6498
|
-
tag$
|
|
6499
|
-
document.head.appendChild(tag$
|
|
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);
|
|
6500
7620
|
}
|
|
6501
|
-
tag$
|
|
7621
|
+
tag$14.textContent = css$14;
|
|
6502
7622
|
var ProblemList_module_css_default = { "problems": "rp_LZh3Iq_problems" };
|
|
6503
7623
|
//#endregion
|
|
6504
7624
|
//#region src/client/widgets/problem-list/ProblemList.tsx
|
|
@@ -6516,16 +7636,16 @@ window.__ModuleLoader__.load({
|
|
|
6516
7636
|
}
|
|
6517
7637
|
//#endregion
|
|
6518
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
|
|
6519
|
-
const css$
|
|
6520
|
-
const key$
|
|
6521
|
-
let tag$
|
|
6522
|
-
if (tag$
|
|
6523
|
-
tag$
|
|
6524
|
-
tag$
|
|
6525
|
-
tag$
|
|
6526
|
-
document.head.appendChild(tag$
|
|
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);
|
|
6527
7647
|
}
|
|
6528
|
-
tag$
|
|
7648
|
+
tag$13.textContent = css$13;
|
|
6529
7649
|
var DeleteSessionDialog_module_css_default = {
|
|
6530
7650
|
"warning": "rp_FifHrW_warning",
|
|
6531
7651
|
"body": "rp_FifHrW_body",
|
|
@@ -6626,39 +7746,39 @@ window.__ModuleLoader__.load({
|
|
|
6626
7746
|
}
|
|
6627
7747
|
//#endregion
|
|
6628
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
|
|
6629
|
-
const css$
|
|
6630
|
-
const key$
|
|
6631
|
-
let tag$
|
|
6632
|
-
if (tag$
|
|
6633
|
-
tag$
|
|
6634
|
-
tag$
|
|
6635
|
-
tag$
|
|
6636
|
-
document.head.appendChild(tag$
|
|
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);
|
|
6637
7757
|
}
|
|
6638
|
-
tag$
|
|
7758
|
+
tag$12.textContent = css$12;
|
|
6639
7759
|
var SessionsPage_module_css_default = {
|
|
6640
|
-
"
|
|
6641
|
-
"
|
|
7760
|
+
"badge": "rp_24z4eW_badge",
|
|
7761
|
+
"message": "rp_24z4eW_message",
|
|
6642
7762
|
"fits": "rp_24z4eW_fits",
|
|
6643
7763
|
"scrolls": "rp_24z4eW_scrolls",
|
|
6644
|
-
"
|
|
6645
|
-
"
|
|
6646
|
-
"number": "rp_24z4eW_number",
|
|
7764
|
+
"viewport": "rp_24z4eW_viewport",
|
|
7765
|
+
"name": "rp_24z4eW_name",
|
|
6647
7766
|
"spinning": "rp_24z4eW_spinning",
|
|
7767
|
+
"number": "rp_24z4eW_number",
|
|
7768
|
+
"archived": "rp_24z4eW_archived",
|
|
7769
|
+
"toolbar": "rp_24z4eW_toolbar",
|
|
6648
7770
|
"nameColumn": "rp_24z4eW_nameColumn",
|
|
6649
|
-
"
|
|
6650
|
-
"
|
|
7771
|
+
"page": "rp_24z4eW_page",
|
|
7772
|
+
"count": "rp_24z4eW_count",
|
|
6651
7773
|
"spin": "rp_24z4eW_spin",
|
|
6652
|
-
"
|
|
6653
|
-
"name": "rp_24z4eW_name",
|
|
6654
|
-
"notice": "rp_24z4eW_notice",
|
|
7774
|
+
"actionsColumn": "rp_24z4eW_actionsColumn",
|
|
6655
7775
|
"worldColumn": "rp_24z4eW_worldColumn",
|
|
6656
|
-
"
|
|
7776
|
+
"timeColumn": "rp_24z4eW_timeColumn",
|
|
7777
|
+
"notice": "rp_24z4eW_notice",
|
|
7778
|
+
"secondary": "rp_24z4eW_secondary",
|
|
7779
|
+
"table": "rp_24z4eW_table",
|
|
6657
7780
|
"actions": "rp_24z4eW_actions",
|
|
6658
|
-
"
|
|
6659
|
-
"turnsColumn": "rp_24z4eW_turnsColumn",
|
|
6660
|
-
"badge": "rp_24z4eW_badge",
|
|
6661
|
-
"actionsColumn": "rp_24z4eW_actionsColumn"
|
|
7781
|
+
"turnsColumn": "rp_24z4eW_turnsColumn"
|
|
6662
7782
|
};
|
|
6663
7783
|
//#endregion
|
|
6664
7784
|
//#region src/client/pages/sessions/SessionsPage.tsx
|
|
@@ -6781,6 +7901,7 @@ window.__ModuleLoader__.load({
|
|
|
6781
7901
|
children: [
|
|
6782
7902
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
|
|
6783
7903
|
className: SessionsPage_module_css_default.name,
|
|
7904
|
+
"data-label": t("columnName"),
|
|
6784
7905
|
title: session.name,
|
|
6785
7906
|
children: [session.name, session.archivedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6786
7907
|
className: SessionsPage_module_css_default.badge,
|
|
@@ -6789,23 +7910,28 @@ window.__ModuleLoader__.load({
|
|
|
6789
7910
|
}),
|
|
6790
7911
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
6791
7912
|
className: SessionsPage_module_css_default.secondary,
|
|
7913
|
+
"data-label": t("columnWorld"),
|
|
6792
7914
|
title: session.worldName,
|
|
6793
7915
|
children: session.worldName
|
|
6794
7916
|
}),
|
|
6795
7917
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
6796
7918
|
className: SessionsPage_module_css_default.secondary,
|
|
7919
|
+
"data-label": t("columnCreated"),
|
|
6797
7920
|
children: dateTime.format(new Date(session.createdAt))
|
|
6798
7921
|
}),
|
|
6799
7922
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
6800
7923
|
className: SessionsPage_module_css_default.secondary,
|
|
7924
|
+
"data-label": t("columnLastPlayed"),
|
|
6801
7925
|
children: session.lastPlayedAt === void 0 ? t("neverPlayed") : dateTime.format(new Date(session.lastPlayedAt))
|
|
6802
7926
|
}),
|
|
6803
7927
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
6804
7928
|
className: `${SessionsPage_module_css_default.secondary} ${SessionsPage_module_css_default.number}`,
|
|
7929
|
+
"data-label": t("columnTurns"),
|
|
6805
7930
|
children: session.turns
|
|
6806
7931
|
}),
|
|
6807
7932
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
|
|
6808
7933
|
className: SessionsPage_module_css_default.actions,
|
|
7934
|
+
"data-label": t("columnActions"),
|
|
6809
7935
|
children: [
|
|
6810
7936
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
6811
7937
|
variant: "ghost",
|
|
@@ -7157,27 +8283,27 @@ window.__ModuleLoader__.load({
|
|
|
7157
8283
|
}
|
|
7158
8284
|
//#endregion
|
|
7159
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
|
|
7160
|
-
const css$
|
|
7161
|
-
const key$
|
|
7162
|
-
let tag$
|
|
7163
|
-
if (tag$
|
|
7164
|
-
tag$
|
|
7165
|
-
tag$
|
|
7166
|
-
tag$
|
|
7167
|
-
document.head.appendChild(tag$
|
|
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);
|
|
7168
8294
|
}
|
|
7169
|
-
tag$
|
|
8295
|
+
tag$11.textContent = css$11;
|
|
7170
8296
|
var WorldCard_module_css_default = {
|
|
7171
|
-
"
|
|
7172
|
-
"
|
|
7173
|
-
"tags": "rp_Bvxx5q_tags",
|
|
8297
|
+
"info": "rp_Bvxx5q_info",
|
|
8298
|
+
"name": "rp_Bvxx5q_name",
|
|
7174
8299
|
"image": "rp_Bvxx5q_image",
|
|
7175
|
-
"tag": "rp_Bvxx5q_tag",
|
|
7176
8300
|
"placeholder": "rp_Bvxx5q_placeholder",
|
|
7177
|
-
"
|
|
7178
|
-
"
|
|
7179
|
-
"
|
|
7180
|
-
"
|
|
8301
|
+
"tags": "rp_Bvxx5q_tags",
|
|
8302
|
+
"cover": "rp_Bvxx5q_cover",
|
|
8303
|
+
"tag": "rp_Bvxx5q_tag",
|
|
8304
|
+
"card": "rp_Bvxx5q_card",
|
|
8305
|
+
"play": "rp_Bvxx5q_play",
|
|
8306
|
+
"openButton": "rp_Bvxx5q_openButton"
|
|
7181
8307
|
};
|
|
7182
8308
|
//#endregion
|
|
7183
8309
|
//#region src/client/widgets/world-card/WorldCard.tsx
|
|
@@ -7188,7 +8314,7 @@ window.__ModuleLoader__.load({
|
|
|
7188
8314
|
return hash;
|
|
7189
8315
|
}
|
|
7190
8316
|
/** A world as a card. It fills the grid cell it is placed in. */
|
|
7191
|
-
function WorldCard({ world, playLabel, onPlay, onOpen }) {
|
|
8317
|
+
function WorldCard({ world, playLabel, openLabel, onPlay, onOpen }) {
|
|
7192
8318
|
const coverSrc = world.coverVersion === void 0 ? void 0 : worldCoverPath(world.id, world.coverVersion);
|
|
7193
8319
|
const [failedSrc, setFailedSrc] = (0, react.useState)();
|
|
7194
8320
|
const showCover = coverSrc !== void 0 && coverSrc !== failedSrc;
|
|
@@ -7200,81 +8326,81 @@ window.__ModuleLoader__.load({
|
|
|
7200
8326
|
portal: true,
|
|
7201
8327
|
disabled: world.description === "",
|
|
7202
8328
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7203
|
-
className:
|
|
7204
|
-
tabIndex: 0,
|
|
8329
|
+
className: WorldCard_module_css_default.card,
|
|
7205
8330
|
"data-testid": "world-card",
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
|
|
7213
|
-
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: () => {
|
|
7214
8337
|
onOpen(world);
|
|
7215
8338
|
}
|
|
7216
|
-
}
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
event
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
className: WorldCard_module_css_default.
|
|
7248
|
-
children:
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
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
|
+
]
|
|
7258
8384
|
})
|
|
7259
8385
|
});
|
|
7260
8386
|
}
|
|
7261
8387
|
//#endregion
|
|
7262
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
|
|
7263
|
-
const css$
|
|
7264
|
-
const key$
|
|
7265
|
-
let tag$
|
|
7266
|
-
if (tag$
|
|
7267
|
-
tag$
|
|
7268
|
-
tag$
|
|
7269
|
-
tag$
|
|
7270
|
-
document.head.appendChild(tag$
|
|
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);
|
|
7271
8397
|
}
|
|
7272
|
-
tag$
|
|
8398
|
+
tag$10.textContent = css$10;
|
|
7273
8399
|
var AvatarChoices_module_css_default = {
|
|
7274
|
-
"summary": "rp_YCstOG_summary",
|
|
7275
8400
|
"option": "rp_YCstOG_option",
|
|
7276
|
-
"
|
|
7277
|
-
"
|
|
8401
|
+
"text": "rp_YCstOG_text",
|
|
8402
|
+
"summary": "rp_YCstOG_summary",
|
|
8403
|
+
"name": "rp_YCstOG_name"
|
|
7278
8404
|
};
|
|
7279
8405
|
//#endregion
|
|
7280
8406
|
//#region src/client/widgets/avatar-choices/AvatarChoices.tsx
|
|
@@ -7303,29 +8429,29 @@ window.__ModuleLoader__.load({
|
|
|
7303
8429
|
}
|
|
7304
8430
|
//#endregion
|
|
7305
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
|
|
7306
|
-
const css$
|
|
7307
|
-
const key$
|
|
7308
|
-
let tag$
|
|
7309
|
-
if (tag$
|
|
7310
|
-
tag$
|
|
7311
|
-
tag$
|
|
7312
|
-
tag$
|
|
7313
|
-
document.head.appendChild(tag$
|
|
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);
|
|
7314
8440
|
}
|
|
7315
|
-
tag$
|
|
8441
|
+
tag$9.textContent = css$9;
|
|
7316
8442
|
var StartSessionDialog_module_css_default = {
|
|
7317
|
-
"
|
|
7318
|
-
"
|
|
7319
|
-
"form": "rp_AnbLKG_form",
|
|
7320
|
-
"advancedBody": "rp_AnbLKG_advancedBody",
|
|
8443
|
+
"advancedToggle": "rp_AnbLKG_advancedToggle",
|
|
8444
|
+
"option": "rp_AnbLKG_option",
|
|
7321
8445
|
"optionName": "rp_AnbLKG_optionName",
|
|
7322
|
-
"label": "rp_AnbLKG_label",
|
|
7323
|
-
"advanced": "rp_AnbLKG_advanced",
|
|
7324
8446
|
"optionSummary": "rp_AnbLKG_optionSummary",
|
|
7325
8447
|
"message": "rp_AnbLKG_message",
|
|
7326
|
-
"
|
|
8448
|
+
"label": "rp_AnbLKG_label",
|
|
7327
8449
|
"field": "rp_AnbLKG_field",
|
|
7328
|
-
"
|
|
8450
|
+
"error": "rp_AnbLKG_error",
|
|
8451
|
+
"optionText": "rp_AnbLKG_optionText",
|
|
8452
|
+
"advanced": "rp_AnbLKG_advanced",
|
|
8453
|
+
"advancedBody": "rp_AnbLKG_advancedBody",
|
|
8454
|
+
"form": "rp_AnbLKG_form"
|
|
7329
8455
|
};
|
|
7330
8456
|
//#endregion
|
|
7331
8457
|
//#region src/client/pages/worlds/AddAvatarsDialog.tsx
|
|
@@ -7445,7 +8571,7 @@ window.__ModuleLoader__.load({
|
|
|
7445
8571
|
options,
|
|
7446
8572
|
fallback
|
|
7447
8573
|
});
|
|
7448
|
-
const text
|
|
8574
|
+
const text = (max, fallback) => ({
|
|
7449
8575
|
kind: "text",
|
|
7450
8576
|
max,
|
|
7451
8577
|
fallback
|
|
@@ -7479,7 +8605,7 @@ window.__ModuleLoader__.load({
|
|
|
7479
8605
|
},
|
|
7480
8606
|
clock: {
|
|
7481
8607
|
mode: choice(CLOCK_MODES, "simulated"),
|
|
7482
|
-
timeZone: text
|
|
8608
|
+
timeZone: text(64, ""),
|
|
7483
8609
|
roundSeconds: integer(0, 3600, 30),
|
|
7484
8610
|
maxSkipDays: integer(1, 3650, 30)
|
|
7485
8611
|
},
|
|
@@ -7501,18 +8627,27 @@ window.__ModuleLoader__.load({
|
|
|
7501
8627
|
shortMaxTokens: integer(256, 64e3, 2e3),
|
|
7502
8628
|
headroom: ratio(1, 10, 2)
|
|
7503
8629
|
},
|
|
7504
|
-
prompts: { language: text
|
|
7505
|
-
reasoning: { children: text
|
|
8630
|
+
prompts: { language: text(8, "en") },
|
|
8631
|
+
reasoning: { children: text(40, "") },
|
|
7506
8632
|
factions: {
|
|
7507
8633
|
perTurn: integer(0, 3, 1),
|
|
7508
8634
|
everyDays: integer(1, 365, 3)
|
|
7509
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
|
+
},
|
|
7510
8645
|
models: {
|
|
7511
|
-
characters: text
|
|
7512
|
-
background: text
|
|
7513
|
-
records: text
|
|
7514
|
-
suggestions: text
|
|
7515
|
-
authoring: text
|
|
8646
|
+
characters: text(200, ""),
|
|
8647
|
+
background: text(200, ""),
|
|
8648
|
+
records: text(200, ""),
|
|
8649
|
+
suggestions: text(200, ""),
|
|
8650
|
+
authoring: text(200, "")
|
|
7516
8651
|
},
|
|
7517
8652
|
triggers: {
|
|
7518
8653
|
enabled: flag(true),
|
|
@@ -7521,9 +8656,9 @@ window.__ModuleLoader__.load({
|
|
|
7521
8656
|
cueTurns: integer(1, 20, 2),
|
|
7522
8657
|
judgedPerTurn: integer(0, 5, 2)
|
|
7523
8658
|
},
|
|
7524
|
-
interface: { pack: text
|
|
8659
|
+
interface: { pack: text(60, "") },
|
|
7525
8660
|
rewind: { keepSnapshots: integer(0, 500, 30) },
|
|
7526
|
-
rules: { own: text
|
|
8661
|
+
rules: { own: text(MAX_OWN_RULES, "") },
|
|
7527
8662
|
preview: { enabled: flag(true) },
|
|
7528
8663
|
suggestions: { count: integer(0, 5, 3) },
|
|
7529
8664
|
images: {
|
|
@@ -7540,8 +8675,8 @@ window.__ModuleLoader__.load({
|
|
|
7540
8675
|
reuse: flag(true),
|
|
7541
8676
|
highRes: flag(false),
|
|
7542
8677
|
interpret: flag(true),
|
|
7543
|
-
interpreterModel: text
|
|
7544
|
-
captioner: text
|
|
8678
|
+
interpreterModel: text(200, ""),
|
|
8679
|
+
captioner: text(200, "")
|
|
7545
8680
|
},
|
|
7546
8681
|
embedding: { options: record() }
|
|
7547
8682
|
};
|
|
@@ -7726,6 +8861,48 @@ window.__ModuleLoader__.load({
|
|
|
7726
8861
|
label: "factionsEveryDays",
|
|
7727
8862
|
help: "factionsEveryDaysHelp"
|
|
7728
8863
|
},
|
|
8864
|
+
{
|
|
8865
|
+
path: ["reflection", "auto"],
|
|
8866
|
+
kind: "flag",
|
|
8867
|
+
label: "reflectionAuto",
|
|
8868
|
+
help: "reflectionAutoHelp"
|
|
8869
|
+
},
|
|
8870
|
+
{
|
|
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
|
+
},
|
|
7729
8906
|
{
|
|
7730
8907
|
path: ["models", "characters"],
|
|
7731
8908
|
kind: "text",
|
|
@@ -7981,7 +9158,8 @@ window.__ModuleLoader__.load({
|
|
|
7981
9158
|
maxRounds: "2",
|
|
7982
9159
|
maxCharacters: "3",
|
|
7983
9160
|
"offstage.perTurn": "0",
|
|
7984
|
-
"authoring.enabled": false
|
|
9161
|
+
"authoring.enabled": false,
|
|
9162
|
+
"reflection.auto": false
|
|
7985
9163
|
};
|
|
7986
9164
|
const keyOf = (field) => field.path.join(".");
|
|
7987
9165
|
function read$1(root, path) {
|
|
@@ -8112,25 +9290,25 @@ window.__ModuleLoader__.load({
|
|
|
8112
9290
|
}
|
|
8113
9291
|
//#endregion
|
|
8114
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
|
|
8115
|
-
const css$
|
|
8116
|
-
const key$
|
|
8117
|
-
let tag$
|
|
8118
|
-
if (tag$
|
|
8119
|
-
tag$
|
|
8120
|
-
tag$
|
|
8121
|
-
tag$
|
|
8122
|
-
document.head.appendChild(tag$
|
|
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);
|
|
8123
9301
|
}
|
|
8124
|
-
tag$
|
|
9302
|
+
tag$8.textContent = css$8;
|
|
8125
9303
|
var SettingsFields_module_css_default = {
|
|
8126
|
-
"error": "rp_Rhi3yq_error",
|
|
8127
|
-
"help": "rp_Rhi3yq_help",
|
|
8128
|
-
"field": "rp_Rhi3yq_field",
|
|
8129
9304
|
"row": "rp_Rhi3yq_row",
|
|
8130
|
-
"
|
|
8131
|
-
"
|
|
9305
|
+
"field": "rp_Rhi3yq_field",
|
|
9306
|
+
"label": "rp_Rhi3yq_label",
|
|
8132
9307
|
"group": "rp_Rhi3yq_group",
|
|
8133
|
-
"
|
|
9308
|
+
"error": "rp_Rhi3yq_error",
|
|
9309
|
+
"area": "rp_Rhi3yq_area",
|
|
9310
|
+
"help": "rp_Rhi3yq_help",
|
|
9311
|
+
"groupTitle": "rp_Rhi3yq_groupTitle"
|
|
8134
9312
|
};
|
|
8135
9313
|
//#endregion
|
|
8136
9314
|
//#region src/client/settings-form/SettingsFields.tsx
|
|
@@ -8698,36 +9876,36 @@ window.__ModuleLoader__.load({
|
|
|
8698
9876
|
}
|
|
8699
9877
|
//#endregion
|
|
8700
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
|
|
8701
|
-
const css$
|
|
8702
|
-
const key$
|
|
8703
|
-
let tag$
|
|
8704
|
-
if (tag$
|
|
8705
|
-
tag$
|
|
8706
|
-
tag$
|
|
8707
|
-
tag$
|
|
8708
|
-
document.head.appendChild(tag$
|
|
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);
|
|
8709
9887
|
}
|
|
8710
|
-
tag$
|
|
9888
|
+
tag$7.textContent = css$7;
|
|
8711
9889
|
var WorldsPage_module_css_default = {
|
|
9890
|
+
"editBody": "rp_FHUyRq_editBody",
|
|
8712
9891
|
"grid": "rp_FHUyRq_grid",
|
|
8713
|
-
"authorButton": "rp_FHUyRq_authorButton",
|
|
8714
|
-
"notice": "rp_FHUyRq_notice",
|
|
8715
|
-
"cell": "rp_FHUyRq_cell",
|
|
8716
|
-
"editHeader": "rp_FHUyRq_editHeader",
|
|
8717
9892
|
"viewport": "rp_FHUyRq_viewport",
|
|
8718
|
-
"editBody": "rp_FHUyRq_editBody",
|
|
8719
9893
|
"starters": "rp_FHUyRq_starters",
|
|
9894
|
+
"editHeader": "rp_FHUyRq_editHeader",
|
|
9895
|
+
"notice": "rp_FHUyRq_notice",
|
|
9896
|
+
"spin": "rp_FHUyRq_spin",
|
|
9897
|
+
"scrolls": "rp_FHUyRq_scrolls",
|
|
9898
|
+
"fits": "rp_FHUyRq_fits",
|
|
9899
|
+
"editTitle": "rp_FHUyRq_editTitle",
|
|
8720
9900
|
"starter": "rp_FHUyRq_starter",
|
|
8721
9901
|
"toolbarActions": "rp_FHUyRq_toolbarActions",
|
|
9902
|
+
"count": "rp_FHUyRq_count",
|
|
8722
9903
|
"spinning": "rp_FHUyRq_spinning",
|
|
8723
|
-
"
|
|
8724
|
-
"
|
|
8725
|
-
"editTitle": "rp_FHUyRq_editTitle",
|
|
8726
|
-
"fits": "rp_FHUyRq_fits",
|
|
8727
|
-
"scrolls": "rp_FHUyRq_scrolls",
|
|
9904
|
+
"authorButton": "rp_FHUyRq_authorButton",
|
|
9905
|
+
"cell": "rp_FHUyRq_cell",
|
|
8728
9906
|
"message": "rp_FHUyRq_message",
|
|
8729
|
-
"
|
|
8730
|
-
"
|
|
9907
|
+
"page": "rp_FHUyRq_page",
|
|
9908
|
+
"toolbar": "rp_FHUyRq_toolbar"
|
|
8731
9909
|
};
|
|
8732
9910
|
//#endregion
|
|
8733
9911
|
//#region src/client/pages/worlds/StarterWorlds.tsx
|
|
@@ -8826,45 +10004,45 @@ window.__ModuleLoader__.load({
|
|
|
8826
10004
|
const pictureUrl = (id) => `${API_PREFIX}/worlds/import/picture?id=${encodeURIComponent(id)}`;
|
|
8827
10005
|
//#endregion
|
|
8828
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
|
|
8829
|
-
const css$
|
|
8830
|
-
const key$
|
|
8831
|
-
let tag$
|
|
8832
|
-
if (tag$
|
|
8833
|
-
tag$
|
|
8834
|
-
tag$
|
|
8835
|
-
tag$
|
|
8836
|
-
document.head.appendChild(tag$
|
|
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);
|
|
8837
10015
|
}
|
|
8838
|
-
tag$
|
|
10016
|
+
tag$6.textContent = css$6;
|
|
8839
10017
|
var ImportCardPage_module_css_default = {
|
|
8840
|
-
"header": "rp_DmG_oG_header",
|
|
8841
|
-
"picture": "rp_DmG_oG_picture",
|
|
8842
10018
|
"top": "rp_DmG_oG_top",
|
|
8843
|
-
"
|
|
8844
|
-
"tags": "rp_DmG_oG_tags",
|
|
8845
|
-
"entry": "rp_DmG_oG_entry",
|
|
8846
|
-
"error": "rp_DmG_oG_error",
|
|
8847
|
-
"fieldMeta": "rp_DmG_oG_fieldMeta",
|
|
10019
|
+
"fieldTitle": "rp_DmG_oG_fieldTitle",
|
|
8848
10020
|
"text": "rp_DmG_oG_text",
|
|
8849
|
-
"
|
|
10021
|
+
"entryOff": "rp_DmG_oG_entryOff",
|
|
10022
|
+
"picture": "rp_DmG_oG_picture",
|
|
10023
|
+
"heading": "rp_DmG_oG_heading",
|
|
8850
10024
|
"about": "rp_DmG_oG_about",
|
|
8851
|
-
"
|
|
8852
|
-
"
|
|
10025
|
+
"title": "rp_DmG_oG_title",
|
|
10026
|
+
"tags": "rp_DmG_oG_tags",
|
|
8853
10027
|
"page": "rp_DmG_oG_page",
|
|
8854
|
-
"
|
|
10028
|
+
"note": "rp_DmG_oG_note",
|
|
10029
|
+
"entryHead": "rp_DmG_oG_entryHead",
|
|
8855
10030
|
"body": "rp_DmG_oG_body",
|
|
8856
|
-
"fieldHead": "rp_DmG_oG_fieldHead",
|
|
8857
10031
|
"section": "rp_DmG_oG_section",
|
|
8858
|
-
"
|
|
8859
|
-
"
|
|
10032
|
+
"entryTitle": "rp_DmG_oG_entryTitle",
|
|
10033
|
+
"fieldMeta": "rp_DmG_oG_fieldMeta",
|
|
8860
10034
|
"choiceText": "rp_DmG_oG_choiceText",
|
|
8861
|
-
"
|
|
8862
|
-
"row": "rp_DmG_oG_row",
|
|
10035
|
+
"preview": "rp_DmG_oG_preview",
|
|
8863
10036
|
"noPicture": "rp_DmG_oG_noPicture",
|
|
8864
|
-
"
|
|
8865
|
-
"
|
|
8866
|
-
"
|
|
8867
|
-
"
|
|
10037
|
+
"error": "rp_DmG_oG_error",
|
|
10038
|
+
"space": "rp_DmG_oG_space",
|
|
10039
|
+
"entry": "rp_DmG_oG_entry",
|
|
10040
|
+
"header": "rp_DmG_oG_header",
|
|
10041
|
+
"label": "rp_DmG_oG_label",
|
|
10042
|
+
"row": "rp_DmG_oG_row",
|
|
10043
|
+
"fieldHead": "rp_DmG_oG_fieldHead",
|
|
10044
|
+
"choice": "rp_DmG_oG_choice",
|
|
10045
|
+
"field": "rp_DmG_oG_field"
|
|
8868
10046
|
};
|
|
8869
10047
|
//#endregion
|
|
8870
10048
|
//#region src/client/pages/worlds/ImportCardPage.tsx
|
|
@@ -8995,7 +10173,9 @@ window.__ModuleLoader__.load({
|
|
|
8995
10173
|
children: [preview.hasAvatar ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
8996
10174
|
className: ImportCardPage_module_css_default.picture,
|
|
8997
10175
|
src: pictureUrl(preview.id),
|
|
8998
|
-
alt: ""
|
|
10176
|
+
alt: "",
|
|
10177
|
+
loading: "lazy",
|
|
10178
|
+
decoding: "async"
|
|
8999
10179
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9000
10180
|
className: `${ImportCardPage_module_css_default.picture} ${ImportCardPage_module_css_default.noPicture}`,
|
|
9001
10181
|
children: t("importNoPicture")
|
|
@@ -9415,6 +10595,7 @@ window.__ModuleLoader__.load({
|
|
|
9415
10595
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorldCard, {
|
|
9416
10596
|
world,
|
|
9417
10597
|
playLabel: t("play"),
|
|
10598
|
+
openLabel: t("openWorld", { name: world.name }),
|
|
9418
10599
|
onPlay: () => {
|
|
9419
10600
|
openStartDialog(world.id, world.name);
|
|
9420
10601
|
},
|
|
@@ -9559,6 +10740,20 @@ window.__ModuleLoader__.load({
|
|
|
9559
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.",
|
|
9560
10741
|
factionsEveryDays: "Days between their decisions",
|
|
9561
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.",
|
|
9562
10757
|
modelsBackground: "Model for background characters",
|
|
9563
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.",
|
|
9564
10759
|
modelsCharacters: "Model for characters",
|
|
@@ -9692,6 +10887,20 @@ window.__ModuleLoader__.load({
|
|
|
9692
10887
|
factionsPerTurnHelp: "你发送一条消息后,最多让多少个组织决定自己的行动(前提是自它们上次行动以来故事时间已经过去)。每个组织占用一次后台请求。0 表示关闭。",
|
|
9693
10888
|
factionsEveryDays: "决策间隔天数",
|
|
9694
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: "只有角色积攒了这么多新的见闻才会被处理。手动开始的反思只需要一条。",
|
|
9695
10904
|
modelsBackground: "背景角色使用的模型",
|
|
9696
10905
|
modelsBackgroundHelp: "写成 提供方/模型。背景层级的角色(人群、路人)使用此模型;留空则使用“角色使用的模型”。它们的参与方式与其他角色相同,只是换成更便宜的模型。",
|
|
9697
10906
|
modelsCharacters: "角色使用的模型",
|
|
@@ -9763,6 +10972,7 @@ window.__ModuleLoader__.load({
|
|
|
9763
10972
|
pageOf: "Page {page} of {pages}",
|
|
9764
10973
|
problems: "{count} problem(s) found while reading worlds",
|
|
9765
10974
|
play: "Start a new session",
|
|
10975
|
+
openWorld: "Edit {name}",
|
|
9766
10976
|
worldMissing: "This world is no longer there.",
|
|
9767
10977
|
importCard: "Import card",
|
|
9768
10978
|
importUploading: "Reading the card…",
|
|
@@ -9858,6 +11068,7 @@ window.__ModuleLoader__.load({
|
|
|
9858
11068
|
pageOf: "第 {page} 页,共 {pages} 页",
|
|
9859
11069
|
problems: "读取世界卡时发现 {count} 个问题",
|
|
9860
11070
|
play: "开始新存档",
|
|
11071
|
+
openWorld: "编辑{name}",
|
|
9861
11072
|
worldMissing: "这个世界已经不存在了。",
|
|
9862
11073
|
importCard: "导入角色卡",
|
|
9863
11074
|
importUploading: "正在读取角色卡…",
|
|
@@ -10081,929 +11292,561 @@ window.__ModuleLoader__.load({
|
|
|
10081
11292
|
});
|
|
10082
11293
|
}
|
|
10083
11294
|
}
|
|
10084
|
-
closeStartDialog() {
|
|
10085
|
-
if (this.store.getSnapshot().dialog?.submitting === true) return;
|
|
10086
|
-
this.dialogs++;
|
|
10087
|
-
this.store.update((draft) => {
|
|
10088
|
-
delete draft.dialog;
|
|
10089
|
-
});
|
|
10090
|
-
}
|
|
10091
|
-
/** Start the session the open dialog asks for; the dialog stays open, with the reason, if that fails. */
|
|
10092
|
-
async startSession(options) {
|
|
10093
|
-
const dialog = this.store.getSnapshot().dialog;
|
|
10094
|
-
if (dialog === void 0 || dialog.status !== "ready" || dialog.submitting) return;
|
|
10095
|
-
const token = this.dialogs;
|
|
10096
|
-
this.updateDialog(token, (draft) => {
|
|
10097
|
-
draft.submitting = true;
|
|
10098
|
-
delete draft.error;
|
|
10099
|
-
});
|
|
10100
|
-
try {
|
|
10101
|
-
const started = await request$1("/sessions", {
|
|
10102
|
-
method: "POST",
|
|
10103
|
-
headers: { "content-type": "application/json" },
|
|
10104
|
-
body: JSON.stringify({
|
|
10105
|
-
worldId: dialog.worldId,
|
|
10106
|
-
name: options.name,
|
|
10107
|
-
...options.playerCharacterId === void 0 ? {} : { playerCharacterId: options.playerCharacterId },
|
|
10108
|
-
...options.playerAvatar === void 0 ? {} : { playerAvatar: options.playerAvatar },
|
|
10109
|
-
...options.avatars.length === 0 ? {} : { avatars: options.avatars },
|
|
10110
|
-
...options.opening === void 0 ? {} : { opening: options.opening },
|
|
10111
|
-
...options.startingTime === void 0 ? {} : { startingTime: options.startingTime },
|
|
10112
|
-
...options.settings === void 0 ? {} : { settings: options.settings }
|
|
10113
|
-
})
|
|
10114
|
-
}, this.abort.signal);
|
|
10115
|
-
this.dialogs++;
|
|
10116
|
-
this.store.update((draft) => {
|
|
10117
|
-
delete draft.dialog;
|
|
10118
|
-
});
|
|
10119
|
-
try {
|
|
10120
|
-
this.openChat(started.chatSessionId);
|
|
10121
|
-
} catch (error) {
|
|
10122
|
-
this.store.update((draft) => {
|
|
10123
|
-
draft.started = {
|
|
10124
|
-
sequence: ++this.notices,
|
|
10125
|
-
sessionName: started.name,
|
|
10126
|
-
reason: messageOf(error)
|
|
10127
|
-
};
|
|
10128
|
-
});
|
|
10129
|
-
}
|
|
10130
|
-
} catch (error) {
|
|
10131
|
-
if (this.abort.signal.aborted) return;
|
|
10132
|
-
this.updateDialog(token, (draft) => {
|
|
10133
|
-
draft.submitting = false;
|
|
10134
|
-
draft.error = messageOf(error);
|
|
10135
|
-
});
|
|
10136
|
-
}
|
|
10137
|
-
}
|
|
10138
|
-
dispose() {
|
|
10139
|
-
this.abort.abort();
|
|
10140
|
-
}
|
|
10141
|
-
/** Apply a change to the dialog only while it is still the one that asked. */
|
|
10142
|
-
updateDialog(token, change) {
|
|
10143
|
-
if (token !== this.dialogs) return;
|
|
10144
|
-
this.store.update((draft) => {
|
|
10145
|
-
if (draft.dialog !== void 0) change(draft.dialog);
|
|
10146
|
-
});
|
|
10147
|
-
}
|
|
10148
|
-
/** A failure keeps the list already shown; with nothing shown yet it becomes the page's state. */
|
|
10149
|
-
async run(path, init) {
|
|
10150
|
-
try {
|
|
10151
|
-
const payload = await request$1(path, init, this.abort.signal);
|
|
10152
|
-
this.store.update((draft) => {
|
|
10153
|
-
draft.status = "ready";
|
|
10154
|
-
draft.payload = payload;
|
|
10155
|
-
delete draft.error;
|
|
10156
|
-
});
|
|
10157
|
-
} catch (error) {
|
|
10158
|
-
if (this.abort.signal.aborted) return;
|
|
10159
|
-
this.store.update((draft) => {
|
|
10160
|
-
draft.error = messageOf(error);
|
|
10161
|
-
if (draft.payload === void 0) draft.status = "failed";
|
|
10162
|
-
});
|
|
10163
|
-
} finally {
|
|
10164
|
-
if (!this.abort.signal.aborted) this.store.update((draft) => {
|
|
10165
|
-
draft.refreshing = false;
|
|
10166
|
-
});
|
|
10167
|
-
}
|
|
10168
|
-
}
|
|
10169
|
-
};
|
|
10170
|
-
//#endregion
|
|
10171
|
-
//#region src/client/pages/worlds/index.ts
|
|
10172
|
-
const NAMESPACE$7 = "roleplay.worlds";
|
|
10173
|
-
/** Adds the Worlds page to the Role Play panel. */
|
|
10174
|
-
function registerWorldsPage(ctx) {
|
|
10175
|
-
const t = ctx.locale.bind(NAMESPACE$7);
|
|
10176
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$7, dictionaries$5), "roleplay: worlds dictionaries");
|
|
10177
|
-
const worlds = new WorldsController(createChatOpener(ctx), () => t("language"));
|
|
10178
|
-
ctx.effect(() => () => {
|
|
10179
|
-
worlds.dispose();
|
|
10180
|
-
}, "roleplay: worlds requests");
|
|
10181
|
-
ctx.slots.inject("roleplay.page", () => ctx.slots.register({
|
|
10182
|
-
name: "roleplay.page",
|
|
10183
|
-
id: "worlds",
|
|
10184
|
-
order: 0,
|
|
10185
|
-
label: () => t("nav"),
|
|
10186
|
-
locale: NAMESPACE$7,
|
|
10187
|
-
inject: () => worlds.inject()
|
|
10188
|
-
}, WorldsPage));
|
|
10189
|
-
}
|
|
10190
|
-
//#endregion
|
|
10191
|
-
//#region src/shared/chat.ts
|
|
10192
|
-
const CHAT_PREFIX = "session-";
|
|
10193
|
-
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
10194
|
-
/** The roleplay session a DSH chat id could belong to; ordinary DSH chats have ids of the same shape. */
|
|
10195
|
-
function roleplaySessionOf(chat) {
|
|
10196
|
-
if (!chat.startsWith(CHAT_PREFIX)) return void 0;
|
|
10197
|
-
const id = chat.slice(8);
|
|
10198
|
-
return UUID_V4.test(id) ? id : void 0;
|
|
10199
|
-
}
|
|
10200
|
-
//#endregion
|
|
10201
|
-
//#region src/client/branch/branch-controller.ts
|
|
10202
|
-
/**
|
|
10203
|
-
* A chat DSH makes as a branch of a roleplay chat is given a session by the host, named after the first. Here the player is asked
|
|
10204
|
-
* for a name for it. Only a chat that appears while the client runs is asked about, never one that was already there.
|
|
10205
|
-
*/
|
|
10206
|
-
var BranchController = class {
|
|
10207
|
-
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({ saving: false });
|
|
10208
|
-
seen = /* @__PURE__ */ new Set();
|
|
10209
|
-
seeded = false;
|
|
10210
|
-
face = {
|
|
10211
|
-
hooks: { branch: this.store },
|
|
10212
|
-
save: (name) => {
|
|
10213
|
-
this.save(name);
|
|
10214
|
-
},
|
|
10215
|
-
keep: () => {
|
|
10216
|
-
this.store.update((draft) => {
|
|
10217
|
-
delete draft.pending;
|
|
10218
|
-
delete draft.error;
|
|
10219
|
-
});
|
|
10220
|
-
}
|
|
10221
|
-
};
|
|
10222
|
-
inject() {
|
|
10223
|
-
return this.face;
|
|
10224
|
-
}
|
|
10225
|
-
/** Follows DSH's list of chats; returns what stops it. */
|
|
10226
|
-
watch(list) {
|
|
10227
|
-
const look = () => {
|
|
10228
|
-
const state = list.getSnapshot();
|
|
10229
|
-
if (state.phase !== "ready") return;
|
|
10230
|
-
const fresh = Object.keys(state.byId).filter((id) => !this.seen.has(id));
|
|
10231
|
-
for (const id of fresh) this.seen.add(id);
|
|
10232
|
-
if (!this.seeded) {
|
|
10233
|
-
this.seeded = true;
|
|
10234
|
-
return;
|
|
10235
|
-
}
|
|
10236
|
-
for (const id of fresh) {
|
|
10237
|
-
const row = state.byId[id];
|
|
10238
|
-
if (row.origin === "subagent" || row.parentId === void 0 || roleplaySessionOf(id) === void 0 || roleplaySessionOf(row.parentId) === void 0) continue;
|
|
10239
|
-
this.ask(id);
|
|
10240
|
-
}
|
|
10241
|
-
};
|
|
10242
|
-
look();
|
|
10243
|
-
return list.subscribe(look);
|
|
10244
|
-
}
|
|
10245
|
-
async ask(chat) {
|
|
10246
|
-
const response = await fetch(`${API_PREFIX}/sessions`);
|
|
10247
|
-
if (!response.ok) return;
|
|
10248
|
-
const session = (await response.json()).sessions.find((candidate) => candidate.chatSessionId === chat);
|
|
10249
|
-
if (session === void 0) return;
|
|
11295
|
+
closeStartDialog() {
|
|
11296
|
+
if (this.store.getSnapshot().dialog?.submitting === true) return;
|
|
11297
|
+
this.dialogs++;
|
|
10250
11298
|
this.store.update((draft) => {
|
|
10251
|
-
draft.
|
|
10252
|
-
id: session.id,
|
|
10253
|
-
name: session.name
|
|
10254
|
-
};
|
|
10255
|
-
delete draft.error;
|
|
11299
|
+
delete draft.dialog;
|
|
10256
11300
|
});
|
|
10257
11301
|
}
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
11302
|
+
/** Start the session the open dialog asks for; the dialog stays open, with the reason, if that fails. */
|
|
11303
|
+
async startSession(options) {
|
|
11304
|
+
const dialog = this.store.getSnapshot().dialog;
|
|
11305
|
+
if (dialog === void 0 || dialog.status !== "ready" || dialog.submitting) return;
|
|
11306
|
+
const token = this.dialogs;
|
|
11307
|
+
this.updateDialog(token, (draft) => {
|
|
11308
|
+
draft.submitting = true;
|
|
10263
11309
|
delete draft.error;
|
|
10264
11310
|
});
|
|
10265
11311
|
try {
|
|
10266
|
-
const
|
|
11312
|
+
const started = await request$1("/sessions", {
|
|
10267
11313
|
method: "POST",
|
|
10268
11314
|
headers: { "content-type": "application/json" },
|
|
10269
|
-
body: JSON.stringify({
|
|
10270
|
-
|
|
10271
|
-
|
|
11315
|
+
body: JSON.stringify({
|
|
11316
|
+
worldId: dialog.worldId,
|
|
11317
|
+
name: options.name,
|
|
11318
|
+
...options.playerCharacterId === void 0 ? {} : { playerCharacterId: options.playerCharacterId },
|
|
11319
|
+
...options.playerAvatar === void 0 ? {} : { playerAvatar: options.playerAvatar },
|
|
11320
|
+
...options.avatars.length === 0 ? {} : { avatars: options.avatars },
|
|
11321
|
+
...options.opening === void 0 ? {} : { opening: options.opening },
|
|
11322
|
+
...options.startingTime === void 0 ? {} : { startingTime: options.startingTime },
|
|
11323
|
+
...options.settings === void 0 ? {} : { settings: options.settings }
|
|
11324
|
+
})
|
|
11325
|
+
}, this.abort.signal);
|
|
11326
|
+
this.dialogs++;
|
|
10272
11327
|
this.store.update((draft) => {
|
|
10273
|
-
draft.
|
|
10274
|
-
delete draft.pending;
|
|
11328
|
+
delete draft.dialog;
|
|
10275
11329
|
});
|
|
11330
|
+
try {
|
|
11331
|
+
this.openChat(started.chatSessionId);
|
|
11332
|
+
} catch (error) {
|
|
11333
|
+
this.store.update((draft) => {
|
|
11334
|
+
draft.started = {
|
|
11335
|
+
sequence: ++this.notices,
|
|
11336
|
+
sessionName: started.name,
|
|
11337
|
+
reason: messageOf(error)
|
|
11338
|
+
};
|
|
11339
|
+
});
|
|
11340
|
+
}
|
|
10276
11341
|
} catch (error) {
|
|
10277
|
-
this.
|
|
10278
|
-
|
|
10279
|
-
draft.
|
|
11342
|
+
if (this.abort.signal.aborted) return;
|
|
11343
|
+
this.updateDialog(token, (draft) => {
|
|
11344
|
+
draft.submitting = false;
|
|
11345
|
+
draft.error = messageOf(error);
|
|
10280
11346
|
});
|
|
10281
11347
|
}
|
|
10282
11348
|
}
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/branch/BranchDialog.module.css.mjs
|
|
10286
|
-
const css$6 = ".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}";
|
|
10287
|
-
const key$6 = "src/client/branch/BranchDialog.module.css";
|
|
10288
|
-
let tag$6 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$6) + "]");
|
|
10289
|
-
if (tag$6 === null) {
|
|
10290
|
-
tag$6 = document.createElement("style");
|
|
10291
|
-
tag$6.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
10292
|
-
tag$6.dataset.pluginCss = key$6;
|
|
10293
|
-
document.head.appendChild(tag$6);
|
|
10294
|
-
}
|
|
10295
|
-
tag$6.textContent = css$6;
|
|
10296
|
-
var BranchDialog_module_css_default = {
|
|
10297
|
-
"field": "rp_Dy1TaW_field",
|
|
10298
|
-
"form": "rp_Dy1TaW_form",
|
|
10299
|
-
"label": "rp_Dy1TaW_label",
|
|
10300
|
-
"error": "rp_Dy1TaW_error"
|
|
10301
|
-
};
|
|
10302
|
-
//#endregion
|
|
10303
|
-
//#region src/client/branch/BranchDialog.tsx
|
|
10304
|
-
/** Asks for the name of a session that was just branched off another. */
|
|
10305
|
-
function BranchDialog({ t, useBranch, save, keep }) {
|
|
10306
|
-
const state = useBranch((snapshot) => snapshot);
|
|
10307
|
-
if (state.pending === void 0) return null;
|
|
10308
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Naming, {
|
|
10309
|
-
t,
|
|
10310
|
-
initial: state.pending.name,
|
|
10311
|
-
saving: state.saving,
|
|
10312
|
-
error: state.error,
|
|
10313
|
-
save,
|
|
10314
|
-
keep
|
|
10315
|
-
}, state.pending.id);
|
|
10316
|
-
}
|
|
10317
|
-
function Naming({ t, initial, saving, error, save, keep }) {
|
|
10318
|
-
const formId = (0, react.useId)();
|
|
10319
|
-
const [name, setName] = (0, react.useState)(initial);
|
|
10320
|
-
const canSave = name.trim() !== "" && !saving;
|
|
10321
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
10322
|
-
open: true,
|
|
10323
|
-
onClose: keep,
|
|
10324
|
-
title: t("title"),
|
|
10325
|
-
description: t("description"),
|
|
10326
|
-
closeLabel: t("close"),
|
|
10327
|
-
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
10328
|
-
variant: "ghost",
|
|
10329
|
-
onClick: keep,
|
|
10330
|
-
disabled: saving,
|
|
10331
|
-
children: t("keep")
|
|
10332
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
10333
|
-
variant: "primary",
|
|
10334
|
-
type: "submit",
|
|
10335
|
-
form: formId,
|
|
10336
|
-
disabled: !canSave,
|
|
10337
|
-
children: saving ? t("saving") : t("save")
|
|
10338
|
-
})] }),
|
|
10339
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
10340
|
-
id: formId,
|
|
10341
|
-
className: BranchDialog_module_css_default.form,
|
|
10342
|
-
onSubmit: (event) => {
|
|
10343
|
-
event.preventDefault();
|
|
10344
|
-
if (canSave) save(name);
|
|
10345
|
-
},
|
|
10346
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
10347
|
-
className: BranchDialog_module_css_default.field,
|
|
10348
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10349
|
-
className: BranchDialog_module_css_default.label,
|
|
10350
|
-
children: t("name")
|
|
10351
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
10352
|
-
value: name,
|
|
10353
|
-
maxLength: 200,
|
|
10354
|
-
"data-modal-autofocus": true,
|
|
10355
|
-
onChange: (event) => {
|
|
10356
|
-
setName(event.target.value);
|
|
10357
|
-
}
|
|
10358
|
-
})]
|
|
10359
|
-
}), error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
10360
|
-
className: BranchDialog_module_css_default.error,
|
|
10361
|
-
role: "alert",
|
|
10362
|
-
children: t("failed", { message: error })
|
|
10363
|
-
})]
|
|
10364
|
-
})
|
|
10365
|
-
});
|
|
10366
|
-
}
|
|
10367
|
-
//#endregion
|
|
10368
|
-
//#region src/client/branch/locales.ts
|
|
10369
|
-
const dictionaries$4 = {
|
|
10370
|
-
en: {
|
|
10371
|
-
title: "Name the branch",
|
|
10372
|
-
description: "A new session was made from the story at this point; the first one is as it was.",
|
|
10373
|
-
name: "Name",
|
|
10374
|
-
save: "Save",
|
|
10375
|
-
saving: "Saving…",
|
|
10376
|
-
keep: "Keep this name",
|
|
10377
|
-
close: "Close",
|
|
10378
|
-
failed: "Could not rename the session: {message}"
|
|
10379
|
-
},
|
|
10380
|
-
zh: {
|
|
10381
|
-
title: "为分支命名",
|
|
10382
|
-
description: "已从故事的这一刻另存为新的会话,原会话保持不变。",
|
|
10383
|
-
name: "名称",
|
|
10384
|
-
save: "保存",
|
|
10385
|
-
saving: "正在保存…",
|
|
10386
|
-
keep: "保留此名称",
|
|
10387
|
-
close: "关闭",
|
|
10388
|
-
failed: "无法重命名会话:{message}"
|
|
11349
|
+
dispose() {
|
|
11350
|
+
this.abort.abort();
|
|
10389
11351
|
}
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
id: session
|
|
10417
|
-
}, [session]);
|
|
10418
|
-
if (target === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
10419
|
-
className: GalleryView_module_css_default.message,
|
|
10420
|
-
children: t("notRoleplay")
|
|
10421
|
-
});
|
|
10422
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GalleryView, {
|
|
10423
|
-
t,
|
|
10424
|
-
target
|
|
10425
|
-
});
|
|
10426
|
-
}
|
|
10427
|
-
//#endregion
|
|
10428
|
-
//#region src/client/gallery/index.ts
|
|
10429
|
-
const NAMESPACE$5 = "roleplay.gallery";
|
|
10430
|
-
const VIEW_ID$3 = "roleplay-gallery";
|
|
10431
|
-
/** The shell activates a data target for every view tab; this tab reads from the host itself, so its target is empty. */
|
|
10432
|
-
const galleryTarget = {
|
|
10433
|
-
target: VIEW_ID$3,
|
|
10434
|
-
create: () => ({
|
|
10435
|
-
empty: {},
|
|
10436
|
-
replace: () => ({}),
|
|
10437
|
-
apply: () => ({})
|
|
10438
|
-
})
|
|
10439
|
-
};
|
|
10440
|
-
/** Adds the Gallery tab beside Chat and World: every image of the session in a grid. */
|
|
10441
|
-
function registerGallery(ctx) {
|
|
10442
|
-
const t = ctx.locale.bind(NAMESPACE$5);
|
|
10443
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$10), "roleplay: gallery dictionaries");
|
|
10444
|
-
ctx.inject(["uiConversation"], (scope) => {
|
|
10445
|
-
scope.uiConversation.views.register(galleryTarget);
|
|
10446
|
-
scope.slots.inject("conversation.view", () => scope.slots.register({
|
|
10447
|
-
name: "conversation.view",
|
|
10448
|
-
id: VIEW_ID$3,
|
|
10449
|
-
order: 15,
|
|
10450
|
-
label: () => t("tab"),
|
|
10451
|
-
locale: NAMESPACE$5
|
|
10452
|
-
}, GalleryTab));
|
|
10453
|
-
});
|
|
10454
|
-
}
|
|
10455
|
-
//#endregion
|
|
10456
|
-
//#region src/client/chat-input.ts
|
|
10457
|
-
/** 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. */
|
|
10458
|
-
function facadeOf(scope, sessionId) {
|
|
10459
|
-
const input = () => {
|
|
10460
|
-
const actx = scope.get("sessions")?.scope(sessionId);
|
|
10461
|
-
const conversation = actx?.get("conversation");
|
|
10462
|
-
if (actx === void 0 || conversation === void 0) throw new Error("the input of this chat is not available");
|
|
10463
|
-
return conversation.input.for(actx);
|
|
10464
|
-
};
|
|
10465
|
-
return {
|
|
10466
|
-
pick: (text) => {
|
|
10467
|
-
input().setDraft(text);
|
|
10468
|
-
},
|
|
10469
|
-
fill: (text, send) => {
|
|
10470
|
-
const facade = input();
|
|
10471
|
-
facade.setDraft(text);
|
|
10472
|
-
if (send) facade.submit();
|
|
11352
|
+
/** Apply a change to the dialog only while it is still the one that asked. */
|
|
11353
|
+
updateDialog(token, change) {
|
|
11354
|
+
if (token !== this.dialogs) return;
|
|
11355
|
+
this.store.update((draft) => {
|
|
11356
|
+
if (draft.dialog !== void 0) change(draft.dialog);
|
|
11357
|
+
});
|
|
11358
|
+
}
|
|
11359
|
+
/** A failure keeps the list already shown; with nothing shown yet it becomes the page's state. */
|
|
11360
|
+
async run(path, init) {
|
|
11361
|
+
try {
|
|
11362
|
+
const payload = await request$1(path, init, this.abort.signal);
|
|
11363
|
+
this.store.update((draft) => {
|
|
11364
|
+
draft.status = "ready";
|
|
11365
|
+
draft.payload = payload;
|
|
11366
|
+
delete draft.error;
|
|
11367
|
+
});
|
|
11368
|
+
} catch (error) {
|
|
11369
|
+
if (this.abort.signal.aborted) return;
|
|
11370
|
+
this.store.update((draft) => {
|
|
11371
|
+
draft.error = messageOf(error);
|
|
11372
|
+
if (draft.payload === void 0) draft.status = "failed";
|
|
11373
|
+
});
|
|
11374
|
+
} finally {
|
|
11375
|
+
if (!this.abort.signal.aborted) this.store.update((draft) => {
|
|
11376
|
+
draft.refreshing = false;
|
|
11377
|
+
});
|
|
10473
11378
|
}
|
|
10474
|
-
};
|
|
10475
|
-
}
|
|
10476
|
-
//#endregion
|
|
10477
|
-
//#region src/client/interface/api.ts
|
|
10478
|
-
/** The host says why in `message`; a failure that has none is told by its status. */
|
|
10479
|
-
async function read(response, what) {
|
|
10480
|
-
if (!response.ok) throw new Error((await response.json().catch(() => ({}))).message ?? `${what} (${response.status})`);
|
|
10481
|
-
return await response.json();
|
|
10482
|
-
}
|
|
10483
|
-
const enc = encodeURIComponent;
|
|
10484
|
-
async function packOf(session) {
|
|
10485
|
-
return read(await fetch(`roleplay-api/sessions/interface?id=${enc(session)}`), "the interface pack could not be read");
|
|
10486
|
-
}
|
|
10487
|
-
async function viewOf(session, revision) {
|
|
10488
|
-
return read(await fetch(`roleplay-api/sessions/interface/view?id=${enc(session)}${revision === void 0 ? "" : `&revision=${enc(revision)}`}`), "the story could not be read");
|
|
10489
|
-
}
|
|
10490
|
-
async function historyOf(session, limit) {
|
|
10491
|
-
return read(await fetch(`roleplay-api/sessions/interface/history?id=${enc(session)}&limit=${limit}`), "the story so far could not be read");
|
|
10492
|
-
}
|
|
10493
|
-
async function storeOf(session, request) {
|
|
10494
|
-
return (await read(await fetch(`roleplay-api/sessions/interface/storage?id=${enc(session)}`, {
|
|
10495
|
-
method: "POST",
|
|
10496
|
-
headers: { "content-type": "application/json" },
|
|
10497
|
-
body: JSON.stringify(request)
|
|
10498
|
-
}), "the pack could not keep that")).value;
|
|
10499
|
-
}
|
|
10500
|
-
async function availability() {
|
|
10501
|
-
return read(await fetch("roleplay-api/interface/availability"), "the interface packs could not be looked up");
|
|
10502
|
-
}
|
|
10503
|
-
/** 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. */
|
|
10504
|
-
const frameAddress = (key, file, revision) => `roleplay-api/sessions/interface/frame/${enc(key)}/${file.split("/").map(enc).join("/")}?r=${enc(revision)}`;
|
|
10505
|
-
//#endregion
|
|
10506
|
-
//#region src/client/interface/conversation-body.ts
|
|
10507
|
-
/**
|
|
10508
|
-
* The element that holds a session's transcript and what is drawn behind it, found from something inside the same
|
|
10509
|
-
* conversation: the closest ancestor that contains the scrolling body of the chat, and that body's parent.
|
|
10510
|
-
*/
|
|
10511
|
-
function conversationBody(from) {
|
|
10512
|
-
for (let at = from.parentElement; at !== null; at = at.parentElement) {
|
|
10513
|
-
const scroll = at.querySelector("[class*=\"_scrollBody\"]");
|
|
10514
|
-
if (scroll?.parentElement != null) return {
|
|
10515
|
-
body: scroll.parentElement,
|
|
10516
|
-
scroll
|
|
10517
|
-
};
|
|
10518
11379
|
}
|
|
11380
|
+
};
|
|
11381
|
+
//#endregion
|
|
11382
|
+
//#region src/client/pages/worlds/index.ts
|
|
11383
|
+
const NAMESPACE$7 = "roleplay.worlds";
|
|
11384
|
+
/** Adds the Worlds page to the Role Play panel. */
|
|
11385
|
+
function registerWorldsPage(ctx) {
|
|
11386
|
+
const t = ctx.locale.bind(NAMESPACE$7);
|
|
11387
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$7, dictionaries$5), "roleplay: worlds dictionaries");
|
|
11388
|
+
const worlds = new WorldsController(createChatOpener(ctx), () => t("language"));
|
|
11389
|
+
ctx.effect(() => () => {
|
|
11390
|
+
worlds.dispose();
|
|
11391
|
+
}, "roleplay: worlds requests");
|
|
11392
|
+
ctx.slots.inject("roleplay.page", () => ctx.slots.register({
|
|
11393
|
+
name: "roleplay.page",
|
|
11394
|
+
id: "worlds",
|
|
11395
|
+
order: 0,
|
|
11396
|
+
label: () => t("nav"),
|
|
11397
|
+
locale: NAMESPACE$7,
|
|
11398
|
+
inject: () => worlds.inject()
|
|
11399
|
+
}, WorldsPage));
|
|
10519
11400
|
}
|
|
10520
11401
|
//#endregion
|
|
10521
|
-
//#region src/
|
|
10522
|
-
const
|
|
10523
|
-
const
|
|
10524
|
-
/**
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
*/
|
|
10530
|
-
function useBackdropHost(anchor, enabled) {
|
|
10531
|
-
const [host, setHost] = (0, react.useState)(void 0);
|
|
10532
|
-
(0, react.useEffect)(() => {
|
|
10533
|
-
const from = anchor.current;
|
|
10534
|
-
if (!enabled || from === null) {
|
|
10535
|
-
setHost(void 0);
|
|
10536
|
-
return;
|
|
10537
|
-
}
|
|
10538
|
-
const found = conversationBody(from);
|
|
10539
|
-
if (found === void 0) {
|
|
10540
|
-
console.warn("roleplay: the interface pack has a backdrop, but this page has no place for one");
|
|
10541
|
-
setHost(void 0);
|
|
10542
|
-
return;
|
|
10543
|
-
}
|
|
10544
|
-
const layer = document.createElement("div");
|
|
10545
|
-
layer.setAttribute("data-rp", "backdrop");
|
|
10546
|
-
layer.style.cssText = "position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden";
|
|
10547
|
-
found.body.insertBefore(layer, found.body.firstChild);
|
|
10548
|
-
found.scroll.setAttribute(LIFTED, "");
|
|
10549
|
-
let style = document.head.querySelector(`style[${STYLE}]`);
|
|
10550
|
-
if (style === null) {
|
|
10551
|
-
style = document.createElement("style");
|
|
10552
|
-
style.setAttribute(STYLE, "");
|
|
10553
|
-
style.textContent = `[${LIFTED}]{position:relative;z-index:1}`;
|
|
10554
|
-
document.head.append(style);
|
|
10555
|
-
}
|
|
10556
|
-
setHost(layer);
|
|
10557
|
-
return () => {
|
|
10558
|
-
layer.remove();
|
|
10559
|
-
found.scroll.removeAttribute(LIFTED);
|
|
10560
|
-
if (document.querySelector(`[${LIFTED}]`) === null) document.head.querySelector(`style[${STYLE}]`)?.remove();
|
|
10561
|
-
setHost(void 0);
|
|
10562
|
-
};
|
|
10563
|
-
}, [anchor, enabled]);
|
|
10564
|
-
return host;
|
|
11402
|
+
//#region src/shared/chat.ts
|
|
11403
|
+
const CHAT_PREFIX = "session-";
|
|
11404
|
+
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
11405
|
+
/** The roleplay session a DSH chat id could belong to; ordinary DSH chats have ids of the same shape. */
|
|
11406
|
+
function roleplaySessionOf(chat) {
|
|
11407
|
+
if (!chat.startsWith(CHAT_PREFIX)) return void 0;
|
|
11408
|
+
const id = chat.slice(8);
|
|
11409
|
+
return UUID_V4.test(id) ? id : void 0;
|
|
10565
11410
|
}
|
|
10566
11411
|
//#endregion
|
|
10567
|
-
//#region src/client/
|
|
10568
|
-
const PACK_POLL_MS = 4e3;
|
|
10569
|
-
const VIEW_POLL_MS = 2e3;
|
|
11412
|
+
//#region src/client/branch/branch-controller.ts
|
|
10570
11413
|
/**
|
|
10571
|
-
*
|
|
10572
|
-
*
|
|
11414
|
+
* A chat DSH makes as a branch of a roleplay chat is given a session by the host, named after the first. Here the player is asked
|
|
11415
|
+
* for a name for it. Only a chat that appears while the client runs is asked about, never one that was already there.
|
|
10573
11416
|
*/
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
};
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
const look = () => {
|
|
10593
|
-
fetch(created.value).then((next) => {
|
|
10594
|
-
created.value = next;
|
|
10595
|
-
}, (error) => {
|
|
10596
|
-
created.value = onError(error);
|
|
10597
|
-
}).finally(() => {
|
|
10598
|
-
if (stopped) return;
|
|
10599
|
-
for (const listener of created.listeners) listener(created.value);
|
|
10600
|
-
timer = setTimeout(look, interval);
|
|
10601
|
-
});
|
|
10602
|
-
};
|
|
10603
|
-
created.stop = () => {
|
|
10604
|
-
stopped = true;
|
|
10605
|
-
if (timer !== void 0) clearTimeout(timer);
|
|
10606
|
-
};
|
|
10607
|
-
look();
|
|
10608
|
-
}
|
|
10609
|
-
const listener = (next) => {
|
|
10610
|
-
setValue((previous) => previous === next ? previous : next);
|
|
10611
|
-
};
|
|
10612
|
-
entry.listeners.add(listener);
|
|
10613
|
-
setValue(entry.value);
|
|
10614
|
-
return () => {
|
|
10615
|
-
entry.listeners.delete(listener);
|
|
10616
|
-
if (entry.listeners.size === 0) {
|
|
10617
|
-
entry.stop();
|
|
10618
|
-
cache.delete(key);
|
|
10619
|
-
}
|
|
10620
|
-
};
|
|
10621
|
-
}, [
|
|
10622
|
-
cache,
|
|
10623
|
-
key,
|
|
10624
|
-
active,
|
|
10625
|
-
interval
|
|
10626
|
-
]);
|
|
10627
|
-
return value;
|
|
10628
|
-
}
|
|
10629
|
-
const packs = /* @__PURE__ */ new Map();
|
|
10630
|
-
const views = /* @__PURE__ */ new Map();
|
|
10631
|
-
/** 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. */
|
|
10632
|
-
function usePack(session) {
|
|
10633
|
-
return useShared(packs, session, true, async (previous) => {
|
|
10634
|
-
const found = await packOf(session);
|
|
10635
|
-
return previous !== void 0 && JSON.stringify(previous) === JSON.stringify(found) ? previous : found;
|
|
10636
|
-
}, () => ({
|
|
10637
|
-
pack: null,
|
|
10638
|
-
problems: []
|
|
10639
|
-
}), PACK_POLL_MS);
|
|
10640
|
-
}
|
|
10641
|
-
/** What the player may know of the story, kept up to date while `active`. */
|
|
10642
|
-
function usePlayerView(session, active) {
|
|
10643
|
-
return useShared(views, session, active, async (previous) => {
|
|
10644
|
-
const reply = await viewOf(session, previous?.revision);
|
|
10645
|
-
return reply.unchanged !== true && "view" in reply ? reply.view : previous;
|
|
10646
|
-
}, (error) => {
|
|
10647
|
-
console.warn("roleplay: the story could not be read for the interface pack", error);
|
|
10648
|
-
}, VIEW_POLL_MS);
|
|
10649
|
-
}
|
|
10650
|
-
//#endregion
|
|
10651
|
-
//#region src/shared/interface-pack.ts
|
|
10652
|
-
/** 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. */
|
|
10653
|
-
const STRIP_HEIGHTS = {
|
|
10654
|
-
hud: {
|
|
10655
|
-
min: 24,
|
|
10656
|
-
max: 320,
|
|
10657
|
-
fallback: 56
|
|
10658
|
-
},
|
|
10659
|
-
dock: {
|
|
10660
|
-
min: 24,
|
|
10661
|
-
max: 320,
|
|
10662
|
-
fallback: 48
|
|
10663
|
-
},
|
|
10664
|
-
opening: {
|
|
10665
|
-
min: 120,
|
|
10666
|
-
max: 640,
|
|
10667
|
-
fallback: 320
|
|
10668
|
-
}
|
|
10669
|
-
};
|
|
10670
|
-
const isStrip = (name) => name in STRIP_HEIGHTS;
|
|
10671
|
-
const PACK_LIMITS = {
|
|
10672
|
-
files: 200,
|
|
10673
|
-
bytes: 5242880,
|
|
10674
|
-
fileBytes: 1048576,
|
|
10675
|
-
depth: 4,
|
|
10676
|
-
storageBytes: 65536,
|
|
10677
|
-
history: {
|
|
10678
|
-
fallback: 20,
|
|
10679
|
-
max: 100
|
|
11417
|
+
var BranchController = class {
|
|
11418
|
+
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({ saving: false });
|
|
11419
|
+
seen = /* @__PURE__ */ new Set();
|
|
11420
|
+
seeded = false;
|
|
11421
|
+
face = {
|
|
11422
|
+
hooks: { branch: this.store },
|
|
11423
|
+
save: (name) => {
|
|
11424
|
+
this.save(name);
|
|
11425
|
+
},
|
|
11426
|
+
keep: () => {
|
|
11427
|
+
this.store.update((draft) => {
|
|
11428
|
+
delete draft.pending;
|
|
11429
|
+
delete draft.error;
|
|
11430
|
+
});
|
|
11431
|
+
}
|
|
11432
|
+
};
|
|
11433
|
+
inject() {
|
|
11434
|
+
return this.face;
|
|
10680
11435
|
}
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
const params = message["params"];
|
|
10698
|
-
return {
|
|
10699
|
-
type: "request",
|
|
10700
|
-
id: message["id"],
|
|
10701
|
-
method: message["method"],
|
|
10702
|
-
params: typeof params === "object" && params !== null && !Array.isArray(params) ? params : {}
|
|
11436
|
+
/** Follows DSH's list of chats; returns what stops it. */
|
|
11437
|
+
watch(list) {
|
|
11438
|
+
const look = () => {
|
|
11439
|
+
const state = list.getSnapshot();
|
|
11440
|
+
if (state.phase !== "ready") return;
|
|
11441
|
+
const fresh = Object.keys(state.byId).filter((id) => !this.seen.has(id));
|
|
11442
|
+
for (const id of fresh) this.seen.add(id);
|
|
11443
|
+
if (!this.seeded) {
|
|
11444
|
+
this.seeded = true;
|
|
11445
|
+
return;
|
|
11446
|
+
}
|
|
11447
|
+
for (const id of fresh) {
|
|
11448
|
+
const row = state.byId[id];
|
|
11449
|
+
if (row.origin === "subagent" || row.parentId === void 0 || roleplaySessionOf(id) === void 0 || roleplaySessionOf(row.parentId) === void 0) continue;
|
|
11450
|
+
this.ask(id);
|
|
11451
|
+
}
|
|
10703
11452
|
};
|
|
11453
|
+
look();
|
|
11454
|
+
return list.subscribe(look);
|
|
10704
11455
|
}
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
var Bridge = class {
|
|
10718
|
-
env;
|
|
10719
|
-
stamps = [];
|
|
10720
|
-
spoke;
|
|
10721
|
-
constructor(env) {
|
|
10722
|
-
this.env = env;
|
|
11456
|
+
async ask(chat) {
|
|
11457
|
+
const response = await fetch(`${API_PREFIX}/sessions`);
|
|
11458
|
+
if (!response.ok) return;
|
|
11459
|
+
const session = (await response.json()).sessions.find((candidate) => candidate.chatSessionId === chat);
|
|
11460
|
+
if (session === void 0) return;
|
|
11461
|
+
this.store.update((draft) => {
|
|
11462
|
+
draft.pending = {
|
|
11463
|
+
id: session.id,
|
|
11464
|
+
name: session.name
|
|
11465
|
+
};
|
|
11466
|
+
delete draft.error;
|
|
11467
|
+
});
|
|
10723
11468
|
}
|
|
10724
|
-
async
|
|
11469
|
+
async save(name) {
|
|
11470
|
+
const pending = this.store.getSnapshot().pending;
|
|
11471
|
+
if (pending === void 0 || this.store.getSnapshot().saving) return;
|
|
11472
|
+
this.store.update((draft) => {
|
|
11473
|
+
draft.saving = true;
|
|
11474
|
+
delete draft.error;
|
|
11475
|
+
});
|
|
10725
11476
|
try {
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
11477
|
+
const response = await fetch(`${API_PREFIX}/sessions/rename?id=${encodeURIComponent(pending.id)}`, {
|
|
11478
|
+
method: "POST",
|
|
11479
|
+
headers: { "content-type": "application/json" },
|
|
11480
|
+
body: JSON.stringify({ name })
|
|
11481
|
+
});
|
|
11482
|
+
if (!response.ok) throw new Error((await response.json().catch(() => ({}))).message ?? `the request failed (${response.status})`);
|
|
11483
|
+
this.store.update((draft) => {
|
|
11484
|
+
draft.saving = false;
|
|
11485
|
+
delete draft.pending;
|
|
11486
|
+
});
|
|
10730
11487
|
} catch (error) {
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
error
|
|
10734
|
-
};
|
|
11488
|
+
this.store.update((draft) => {
|
|
11489
|
+
draft.saving = false;
|
|
11490
|
+
draft.error = error instanceof Error ? error.message : String(error);
|
|
11491
|
+
});
|
|
10735
11492
|
}
|
|
10736
11493
|
}
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
11494
|
+
};
|
|
11495
|
+
//#endregion
|
|
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
|
|
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);
|
|
11505
|
+
}
|
|
11506
|
+
tag$5.textContent = css$5;
|
|
11507
|
+
var BranchDialog_module_css_default = {
|
|
11508
|
+
"form": "rp_Dy1TaW_form",
|
|
11509
|
+
"error": "rp_Dy1TaW_error",
|
|
11510
|
+
"label": "rp_Dy1TaW_label",
|
|
11511
|
+
"field": "rp_Dy1TaW_field"
|
|
11512
|
+
};
|
|
11513
|
+
//#endregion
|
|
11514
|
+
//#region src/client/branch/BranchDialog.tsx
|
|
11515
|
+
/** Asks for the name of a session that was just branched off another. */
|
|
11516
|
+
function BranchDialog({ t, useBranch, save, keep }) {
|
|
11517
|
+
const state = useBranch((snapshot) => snapshot);
|
|
11518
|
+
if (state.pending === void 0) return null;
|
|
11519
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Naming, {
|
|
11520
|
+
t,
|
|
11521
|
+
initial: state.pending.name,
|
|
11522
|
+
saving: state.saving,
|
|
11523
|
+
error: state.error,
|
|
11524
|
+
save,
|
|
11525
|
+
keep
|
|
11526
|
+
}, state.pending.id);
|
|
11527
|
+
}
|
|
11528
|
+
function Naming({ t, initial, saving, error, save, keep }) {
|
|
11529
|
+
const formId = (0, react.useId)();
|
|
11530
|
+
const [name, setName] = (0, react.useState)(initial);
|
|
11531
|
+
const canSave = name.trim() !== "" && !saving;
|
|
11532
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
11533
|
+
open: true,
|
|
11534
|
+
onClose: keep,
|
|
11535
|
+
title: t("title"),
|
|
11536
|
+
description: t("description"),
|
|
11537
|
+
closeLabel: t("close"),
|
|
11538
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11539
|
+
variant: "ghost",
|
|
11540
|
+
onClick: keep,
|
|
11541
|
+
disabled: saving,
|
|
11542
|
+
children: t("keep")
|
|
11543
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11544
|
+
variant: "primary",
|
|
11545
|
+
type: "submit",
|
|
11546
|
+
form: formId,
|
|
11547
|
+
disabled: !canSave,
|
|
11548
|
+
children: saving ? t("saving") : t("save")
|
|
11549
|
+
})] }),
|
|
11550
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
11551
|
+
id: formId,
|
|
11552
|
+
className: BranchDialog_module_css_default.form,
|
|
11553
|
+
onSubmit: (event) => {
|
|
11554
|
+
event.preventDefault();
|
|
11555
|
+
if (canSave) save(name);
|
|
11556
|
+
},
|
|
11557
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11558
|
+
className: BranchDialog_module_css_default.field,
|
|
11559
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11560
|
+
className: BranchDialog_module_css_default.label,
|
|
11561
|
+
children: t("name")
|
|
11562
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
11563
|
+
value: name,
|
|
11564
|
+
maxLength: 200,
|
|
11565
|
+
"data-modal-autofocus": true,
|
|
11566
|
+
onChange: (event) => {
|
|
11567
|
+
setName(event.target.value);
|
|
11568
|
+
}
|
|
11569
|
+
})]
|
|
11570
|
+
}), error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11571
|
+
className: BranchDialog_module_css_default.error,
|
|
11572
|
+
role: "alert",
|
|
11573
|
+
children: t("failed", { message: error })
|
|
11574
|
+
})]
|
|
11575
|
+
})
|
|
11576
|
+
});
|
|
11577
|
+
}
|
|
11578
|
+
//#endregion
|
|
11579
|
+
//#region src/client/branch/locales.ts
|
|
11580
|
+
const dictionaries$4 = {
|
|
11581
|
+
en: {
|
|
11582
|
+
title: "Name the branch",
|
|
11583
|
+
description: "A new session was made from the story at this point; the first one is as it was.",
|
|
11584
|
+
name: "Name",
|
|
11585
|
+
save: "Save",
|
|
11586
|
+
saving: "Saving…",
|
|
11587
|
+
keep: "Keep this name",
|
|
11588
|
+
close: "Close",
|
|
11589
|
+
failed: "Could not rename the session: {message}"
|
|
11590
|
+
},
|
|
11591
|
+
zh: {
|
|
11592
|
+
title: "为分支命名",
|
|
11593
|
+
description: "已从故事的这一刻另存为新的会话,原会话保持不变。",
|
|
11594
|
+
name: "名称",
|
|
11595
|
+
save: "保存",
|
|
11596
|
+
saving: "正在保存…",
|
|
11597
|
+
keep: "保留此名称",
|
|
11598
|
+
close: "关闭",
|
|
11599
|
+
failed: "无法重命名会话:{message}"
|
|
10802
11600
|
}
|
|
10803
11601
|
};
|
|
10804
11602
|
//#endregion
|
|
10805
|
-
//#region
|
|
10806
|
-
const
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
11603
|
+
//#region src/client/branch/index.ts
|
|
11604
|
+
const NAMESPACE$6 = "roleplay.branch";
|
|
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. */
|
|
11606
|
+
function registerBranchNaming(ctx) {
|
|
11607
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$6, dictionaries$4), "roleplay: branch dictionaries");
|
|
11608
|
+
const branches = new BranchController();
|
|
11609
|
+
ctx.inject(["sessions"], (inner) => {
|
|
11610
|
+
const sessions = inner.get("sessions");
|
|
11611
|
+
if (sessions !== void 0) inner.effect(() => branches.watch(sessions.list), "roleplay: branch watch");
|
|
11612
|
+
});
|
|
11613
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
11614
|
+
name: "shell.overlay",
|
|
11615
|
+
id: "roleplay-branch",
|
|
11616
|
+
locale: NAMESPACE$6,
|
|
11617
|
+
inject: () => branches.inject()
|
|
11618
|
+
}, BranchDialog));
|
|
10814
11619
|
}
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
11620
|
+
//#endregion
|
|
11621
|
+
//#region src/client/gallery/GalleryTab.tsx
|
|
11622
|
+
/** The Gallery tab of a chat: the pictures of its roleplay session. */
|
|
11623
|
+
function GalleryTab({ t, sessionId }) {
|
|
11624
|
+
const session = roleplaySessionOf(sessionId);
|
|
11625
|
+
const target = (0, react.useMemo)(() => session === void 0 ? void 0 : {
|
|
11626
|
+
kind: "sessions",
|
|
11627
|
+
id: session
|
|
11628
|
+
}, [session]);
|
|
11629
|
+
if (target === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11630
|
+
className: GalleryView_module_css_default.message,
|
|
11631
|
+
children: t("notRoleplay")
|
|
11632
|
+
});
|
|
11633
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GalleryView, {
|
|
11634
|
+
t,
|
|
11635
|
+
target
|
|
11636
|
+
});
|
|
11637
|
+
}
|
|
11638
|
+
//#endregion
|
|
11639
|
+
//#region src/client/gallery/index.ts
|
|
11640
|
+
const NAMESPACE$5 = "roleplay.gallery";
|
|
11641
|
+
const VIEW_ID$3 = "roleplay-gallery";
|
|
11642
|
+
/** The shell activates a data target for every view tab; this tab reads from the host itself, so its target is empty. */
|
|
11643
|
+
const galleryTarget = {
|
|
11644
|
+
target: VIEW_ID$3,
|
|
11645
|
+
create: () => ({
|
|
11646
|
+
empty: {},
|
|
11647
|
+
replace: () => ({}),
|
|
11648
|
+
apply: () => ({})
|
|
11649
|
+
})
|
|
10823
11650
|
};
|
|
11651
|
+
/** Adds the Gallery tab beside Chat and World: every image of the session in a grid. */
|
|
11652
|
+
function registerGallery(ctx) {
|
|
11653
|
+
const t = ctx.locale.bind(NAMESPACE$5);
|
|
11654
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$12), "roleplay: gallery dictionaries");
|
|
11655
|
+
ctx.inject(["uiConversation"], (scope) => {
|
|
11656
|
+
scope.uiConversation.views.register(galleryTarget);
|
|
11657
|
+
scope.slots.inject("conversation.view", () => scope.slots.register({
|
|
11658
|
+
name: "conversation.view",
|
|
11659
|
+
id: VIEW_ID$3,
|
|
11660
|
+
order: 15,
|
|
11661
|
+
label: () => t("tab"),
|
|
11662
|
+
locale: NAMESPACE$5
|
|
11663
|
+
}, GalleryTab));
|
|
11664
|
+
});
|
|
11665
|
+
}
|
|
10824
11666
|
//#endregion
|
|
10825
|
-
//#region src/client/
|
|
10826
|
-
/**
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
"--dsw-alias-border-l3",
|
|
10835
|
-
"--dsw-alias-border-l4",
|
|
10836
|
-
"--dsw-alias-brand-primary",
|
|
10837
|
-
"--dsw-alias-label-primary",
|
|
10838
|
-
"--dsw-alias-label-secondary",
|
|
10839
|
-
"--dsw-alias-label-tertiary",
|
|
10840
|
-
"--dsw-alias-link",
|
|
10841
|
-
"--dsw-alias-state-business-primary",
|
|
10842
|
-
"--dsw-alias-state-error-primary",
|
|
10843
|
-
"--dsw-alias-state-idle-primary",
|
|
10844
|
-
"--dsw-alias-state-success-primary",
|
|
10845
|
-
"--dsw-alias-state-warn-primary",
|
|
10846
|
-
"--dsw-radius-sm"
|
|
10847
|
-
];
|
|
10848
|
-
const DARK_ATTRIBUTE = "data-ds-dark-theme";
|
|
10849
|
-
/** The scheme and the colours the page uses now. */
|
|
10850
|
-
function readTheme(body = document.body) {
|
|
10851
|
-
const style = getComputedStyle(body);
|
|
10852
|
-
const tokens = {};
|
|
10853
|
-
for (const name of SHARED_TOKENS) {
|
|
10854
|
-
const value = style.getPropertyValue(name).trim();
|
|
10855
|
-
if (value !== "") tokens[name] = value;
|
|
10856
|
-
}
|
|
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
|
+
};
|
|
10857
11676
|
return {
|
|
10858
|
-
|
|
10859
|
-
|
|
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
|
+
}
|
|
10860
11685
|
};
|
|
10861
11686
|
}
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
11687
|
+
//#endregion
|
|
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");
|
|
10876
11703
|
}
|
|
10877
11704
|
//#endregion
|
|
10878
|
-
//#region src/client/interface/
|
|
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";
|
|
10879
11708
|
/**
|
|
10880
|
-
*
|
|
10881
|
-
*
|
|
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.
|
|
10882
11711
|
*/
|
|
10883
|
-
function
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
}
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
});
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
}
|
|
10928
|
-
|
|
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);
|
|
10929
11777
|
(0, react.useEffect)(() => {
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
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);
|
|
10950
11802
|
});
|
|
10951
|
-
}
|
|
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);
|
|
10952
11812
|
};
|
|
10953
|
-
|
|
11813
|
+
entry.listeners.add(listener);
|
|
11814
|
+
setValue(entry.value);
|
|
10954
11815
|
return () => {
|
|
10955
|
-
|
|
11816
|
+
entry.listeners.delete(listener);
|
|
11817
|
+
if (entry.listeners.size === 0) {
|
|
11818
|
+
entry.stop();
|
|
11819
|
+
cache.delete(key);
|
|
11820
|
+
}
|
|
10956
11821
|
};
|
|
10957
11822
|
}, [
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
surface
|
|
11823
|
+
cache,
|
|
11824
|
+
key,
|
|
11825
|
+
active,
|
|
11826
|
+
interval
|
|
10963
11827
|
]);
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
name: "turn",
|
|
10987
|
-
data: { turn: view.story.turn }
|
|
10988
|
-
});
|
|
10989
|
-
if (previous !== void 0 && JSON.stringify(view.suggestions) !== JSON.stringify(previous.suggestions)) send({
|
|
10990
|
-
type: "event",
|
|
10991
|
-
name: "suggestions",
|
|
10992
|
-
data: view.suggestions
|
|
10993
|
-
});
|
|
10994
|
-
before.current = view;
|
|
10995
|
-
}, [ready, view]);
|
|
10996
|
-
if (file === void 0) return null;
|
|
10997
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
10998
|
-
ref: frame,
|
|
10999
|
-
className: `${PackFrame_module_css_default.frame}${fill === true ? ` ${PackFrame_module_css_default.fill}` : ""}`,
|
|
11000
|
-
style: fill === true ? void 0 : { height: `${height ?? pack.surfaces[surface]?.height ?? 56}px` },
|
|
11001
|
-
title,
|
|
11002
|
-
src: frameAddress(pack.frame, file, pack.revision),
|
|
11003
|
-
sandbox: "allow-scripts",
|
|
11004
|
-
referrerPolicy: "no-referrer",
|
|
11005
|
-
"data-rp-frame": surface
|
|
11006
|
-
});
|
|
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);
|
|
11007
11850
|
}
|
|
11008
11851
|
//#endregion
|
|
11009
11852
|
//#region src/client/interface/PackDock.tsx
|
|
@@ -11057,7 +11900,7 @@ window.__ModuleLoader__.load({
|
|
|
11057
11900
|
className: PackFrame_module_css_default.hud,
|
|
11058
11901
|
"data-rp": surface,
|
|
11059
11902
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
|
|
11060
|
-
session,
|
|
11903
|
+
backend: sessionBackend(session),
|
|
11061
11904
|
pack,
|
|
11062
11905
|
surface,
|
|
11063
11906
|
view,
|
|
@@ -11072,7 +11915,7 @@ window.__ModuleLoader__.load({
|
|
|
11072
11915
|
hidden: true
|
|
11073
11916
|
}),
|
|
11074
11917
|
layer !== void 0 && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
|
|
11075
|
-
session,
|
|
11918
|
+
backend: sessionBackend(session),
|
|
11076
11919
|
pack,
|
|
11077
11920
|
surface: "backdrop",
|
|
11078
11921
|
view,
|
|
@@ -11111,7 +11954,7 @@ window.__ModuleLoader__.load({
|
|
|
11111
11954
|
className: PackFrame_module_css_default.tab,
|
|
11112
11955
|
"data-rp": "tab",
|
|
11113
11956
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
|
|
11114
|
-
session,
|
|
11957
|
+
backend: sessionBackend(session),
|
|
11115
11958
|
pack,
|
|
11116
11959
|
surface: "tab",
|
|
11117
11960
|
view,
|
|
@@ -11134,17 +11977,17 @@ window.__ModuleLoader__.load({
|
|
|
11134
11977
|
}
|
|
11135
11978
|
tag$4.textContent = css$4;
|
|
11136
11979
|
var SidebarPage_module_css_default = {
|
|
11980
|
+
"main": "rp_Ptco8a_main",
|
|
11137
11981
|
"bar": "rp_Ptco8a_bar",
|
|
11138
|
-
"name": "rp_Ptco8a_name",
|
|
11139
11982
|
"content": "rp_Ptco8a_content",
|
|
11140
|
-
"
|
|
11141
|
-
"page": "rp_Ptco8a_page",
|
|
11142
|
-
"message": "rp_Ptco8a_message",
|
|
11143
|
-
"entry": "rp_Ptco8a_entry",
|
|
11983
|
+
"name": "rp_Ptco8a_name",
|
|
11144
11984
|
"icon": "rp_Ptco8a_icon",
|
|
11145
|
-
"
|
|
11985
|
+
"message": "rp_Ptco8a_message",
|
|
11986
|
+
"page": "rp_Ptco8a_page",
|
|
11146
11987
|
"title": "rp_Ptco8a_title",
|
|
11147
|
-
"description": "rp_Ptco8a_description"
|
|
11988
|
+
"description": "rp_Ptco8a_description",
|
|
11989
|
+
"entry": "rp_Ptco8a_entry",
|
|
11990
|
+
"text": "rp_Ptco8a_text"
|
|
11148
11991
|
};
|
|
11149
11992
|
//#endregion
|
|
11150
11993
|
//#region src/client/interface/SidebarPage.tsx
|
|
@@ -11226,7 +12069,7 @@ window.__ModuleLoader__.load({
|
|
|
11226
12069
|
className: SidebarPage_module_css_default.message,
|
|
11227
12070
|
children: t("sidebarNone")
|
|
11228
12071
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PackFrame, {
|
|
11229
|
-
session,
|
|
12072
|
+
backend: sessionBackend(session),
|
|
11230
12073
|
pack,
|
|
11231
12074
|
surface: "sidebar",
|
|
11232
12075
|
view,
|
|
@@ -11459,7 +12302,7 @@ window.__ModuleLoader__.load({
|
|
|
11459
12302
|
}
|
|
11460
12303
|
//#endregion
|
|
11461
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
|
|
11462
|
-
const css$3 = ".rp_wLpbxW_view{box-sizing:border-box;flex-direction:column;gap:16px;width:100%;max-width:
|
|
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}}";
|
|
11463
12306
|
const key$3 = "src/client/chat-settings/ChatSettingsView.module.css";
|
|
11464
12307
|
let tag$3 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$3) + "]");
|
|
11465
12308
|
if (tag$3 === null) {
|
|
@@ -11470,26 +12313,26 @@ window.__ModuleLoader__.load({
|
|
|
11470
12313
|
}
|
|
11471
12314
|
tag$3.textContent = css$3;
|
|
11472
12315
|
var ChatSettingsView_module_css_default = {
|
|
11473
|
-
"
|
|
11474
|
-
"
|
|
11475
|
-
"
|
|
11476
|
-
"table": "rp_wLpbxW_table",
|
|
12316
|
+
"actions": "rp_wLpbxW_actions",
|
|
12317
|
+
"activity": "rp_wLpbxW_activity",
|
|
12318
|
+
"message": "rp_wLpbxW_message",
|
|
11477
12319
|
"view": "rp_wLpbxW_view",
|
|
11478
12320
|
"field": "rp_wLpbxW_field",
|
|
11479
|
-
"
|
|
11480
|
-
"label": "rp_wLpbxW_label",
|
|
12321
|
+
"table": "rp_wLpbxW_table",
|
|
11481
12322
|
"help": "rp_wLpbxW_help",
|
|
11482
|
-
"
|
|
12323
|
+
"reasons": "rp_wLpbxW_reasons",
|
|
12324
|
+
"pre": "rp_wLpbxW_pre",
|
|
12325
|
+
"label": "rp_wLpbxW_label",
|
|
11483
12326
|
"saved": "rp_wLpbxW_saved",
|
|
11484
|
-
"
|
|
11485
|
-
"
|
|
12327
|
+
"title": "rp_wLpbxW_title",
|
|
12328
|
+
"error": "rp_wLpbxW_error",
|
|
11486
12329
|
"link": "rp_wLpbxW_link",
|
|
11487
|
-
"
|
|
11488
|
-
"
|
|
11489
|
-
"reasons": "rp_wLpbxW_reasons",
|
|
12330
|
+
"row": "rp_wLpbxW_row",
|
|
12331
|
+
"run": "rp_wLpbxW_run",
|
|
11490
12332
|
"list": "rp_wLpbxW_list",
|
|
11491
|
-
"
|
|
11492
|
-
"
|
|
12333
|
+
"description": "rp_wLpbxW_description",
|
|
12334
|
+
"select": "rp_wLpbxW_select",
|
|
12335
|
+
"notice": "rp_wLpbxW_notice"
|
|
11493
12336
|
};
|
|
11494
12337
|
//#endregion
|
|
11495
12338
|
//#region src/client/chat-settings/settings-api.ts
|
|
@@ -11530,6 +12373,18 @@ window.__ModuleLoader__.load({
|
|
|
11530
12373
|
});
|
|
11531
12374
|
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
|
|
11532
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
|
+
}
|
|
11533
12388
|
/** What a helper run was told and did; nothing when the run was not kept or has been dropped. */
|
|
11534
12389
|
async function loadRun(id, run, signal) {
|
|
11535
12390
|
const response = await fetch(`${API_PREFIX}/sessions/activity/run?id=${encodeURIComponent(id)}&run=${encodeURIComponent(run)}`, {
|
|
@@ -11718,6 +12573,65 @@ window.__ModuleLoader__.load({
|
|
|
11718
12573
|
});
|
|
11719
12574
|
}
|
|
11720
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
|
+
}
|
|
12634
|
+
//#endregion
|
|
11721
12635
|
//#region src/client/chat-settings/VectorsSection.tsx
|
|
11722
12636
|
/** What the search by meaning stands on, and a way to start it again with another embedding model. */
|
|
11723
12637
|
function VectorsSection({ t, status, onReset, disabled }) {
|
|
@@ -11962,7 +12876,7 @@ window.__ModuleLoader__.load({
|
|
|
11962
12876
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.turn }),
|
|
11963
12877
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.kind === "beat" ? t("interventionBeat") : t("interventionCue", { who: entry.characters.join(", ") }) }),
|
|
11964
12878
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: entry.text }),
|
|
11965
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: t(entry.status === "waiting" ? "interventionWaiting" : entry.status === "taken" ? "interventionTaken" : "interventionLapsed") })
|
|
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") })
|
|
11966
12880
|
] }, `${entry.turn}-${entry.kind}-${entry.trigger}-${entry.text}`)) })]
|
|
11967
12881
|
})
|
|
11968
12882
|
]
|
|
@@ -12028,6 +12942,13 @@ window.__ModuleLoader__.load({
|
|
|
12028
12942
|
setError(t("vectorsFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
|
|
12029
12943
|
});
|
|
12030
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
|
+
};
|
|
12031
12952
|
const refreshActivity = () => {
|
|
12032
12953
|
if (session === void 0) return;
|
|
12033
12954
|
loadSettings(session, new AbortController().signal).then((next) => {
|
|
@@ -12038,6 +12959,7 @@ window.__ModuleLoader__.load({
|
|
|
12038
12959
|
activity: next.activity,
|
|
12039
12960
|
interventions: next.interventions,
|
|
12040
12961
|
vectors: next.vectors,
|
|
12962
|
+
reflection: next.reflection,
|
|
12041
12963
|
pendingRecords: next.pendingRecords,
|
|
12042
12964
|
pendingConsolidation: next.pendingConsolidation
|
|
12043
12965
|
}
|
|
@@ -12116,6 +13038,13 @@ window.__ModuleLoader__.load({
|
|
|
12116
13038
|
saved: payload.settings.interface.pack,
|
|
12117
13039
|
disabled: saving
|
|
12118
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
|
+
}),
|
|
12119
13048
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(VectorsSection, {
|
|
12120
13049
|
t,
|
|
12121
13050
|
status: payload.vectors,
|
|
@@ -12164,7 +13093,7 @@ window.__ModuleLoader__.load({
|
|
|
12164
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.",
|
|
12165
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.",
|
|
12166
13095
|
interventionsTitle: "What the world put in front of the story",
|
|
12167
|
-
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.",
|
|
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.",
|
|
12168
13097
|
interventionsEmpty: "No trigger has delivered anything yet.",
|
|
12169
13098
|
interventionTurn: "Turn",
|
|
12170
13099
|
interventionKind: "For",
|
|
@@ -12175,6 +13104,7 @@ window.__ModuleLoader__.load({
|
|
|
12175
13104
|
interventionWaiting: "Waiting",
|
|
12176
13105
|
interventionTaken: "Taken up",
|
|
12177
13106
|
interventionLapsed: "Lapsed, nobody took it up",
|
|
13107
|
+
interventionWithdrawn: "Withdrawn: {reason}",
|
|
12178
13108
|
activityTitle: "What the helpers did lately",
|
|
12179
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.",
|
|
12180
13110
|
activityRefresh: "Refresh",
|
|
@@ -12217,6 +13147,19 @@ window.__ModuleLoader__.load({
|
|
|
12217
13147
|
vectorsCancel: "Cancel",
|
|
12218
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.",
|
|
12219
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}",
|
|
12220
13163
|
packTitle: "Interface pack",
|
|
12221
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.",
|
|
12222
13165
|
packActive: "In use: {name}",
|
|
@@ -12252,7 +13195,7 @@ window.__ModuleLoader__.load({
|
|
|
12252
13195
|
pendingConsolidation: "有 {count} 个在故事中新建的角色、地点或物品等待融入世界(与其余部分建立连接和关系),将在后台完成。",
|
|
12253
13196
|
pendingRecords: "有 {count} 个回合等待写入故事记忆。主持人会在故事推进时记录,积压过多时也会自动记录。",
|
|
12254
13197
|
interventionsTitle: "世界摆到故事面前的东西",
|
|
12255
|
-
interventionsHelp: "
|
|
13198
|
+
interventionsHelp: "触发器最近送出的节拍与提示。节拍交给游戏主持人织入故事,提示交给角色。“已采用”表示被用上了,“已失效”表示在期限内没有人理会,“已撤回”表示轮到它被说出时已不再适用(或其文字无法写出),并显示原因。",
|
|
12256
13199
|
interventionsEmpty: "还没有触发器送出过任何东西。",
|
|
12257
13200
|
interventionTurn: "回合",
|
|
12258
13201
|
interventionKind: "送给",
|
|
@@ -12263,6 +13206,7 @@ window.__ModuleLoader__.load({
|
|
|
12263
13206
|
interventionWaiting: "等待中",
|
|
12264
13207
|
interventionTaken: "已采用",
|
|
12265
13208
|
interventionLapsed: "已失效,无人理会",
|
|
13209
|
+
interventionWithdrawn: "已撤回:{reason}",
|
|
12266
13210
|
activityTitle: "助手最近做了什么",
|
|
12267
13211
|
activityHelp: "角色、记录员、建议作者和世界作者都在每一轮的后台运行。这里列出最近的运行及各自耗时。",
|
|
12268
13212
|
activityRefresh: "刷新",
|
|
@@ -12305,6 +13249,19 @@ window.__ModuleLoader__.load({
|
|
|
12305
13249
|
vectorsCancel: "取消",
|
|
12306
13250
|
vectorsHelp: "更换嵌入模型后使用。文本会保留,之后按需由新模型重新生成向量,在此之前记忆只按字词查找。",
|
|
12307
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}",
|
|
12308
13265
|
packTitle: "界面包",
|
|
12309
13266
|
packHelp: "界面包会改变此故事的外观,并可添加状态条、按钮、开场卡片、背景或标签页。世界可以自带界面包;你自己的放在角色扮演目录的 ui 文件夹中。",
|
|
12310
13267
|
packActive: "使用中:{name}",
|
|
@@ -12635,7 +13592,7 @@ window.__ModuleLoader__.load({
|
|
|
12635
13592
|
};
|
|
12636
13593
|
//#endregion
|
|
12637
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
|
|
12638
|
-
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
|
|
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}}";
|
|
12639
13596
|
const key$2 = "src/client/transcript/NarrationView.module.css";
|
|
12640
13597
|
let tag$2 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$2) + "]");
|
|
12641
13598
|
if (tag$2 === null) {
|
|
@@ -12646,25 +13603,25 @@ window.__ModuleLoader__.load({
|
|
|
12646
13603
|
}
|
|
12647
13604
|
tag$2.textContent = css$2;
|
|
12648
13605
|
var NarrationView_module_css_default = {
|
|
12649
|
-
"
|
|
13606
|
+
"line": "rp_NFPimG_line",
|
|
13607
|
+
"playLine": "rp_NFPimG_playLine",
|
|
12650
13608
|
"speech": "rp_NFPimG_speech",
|
|
12651
13609
|
"preview": "rp_NFPimG_preview",
|
|
13610
|
+
"output": "rp_NFPimG_output",
|
|
13611
|
+
"note": "rp_NFPimG_note",
|
|
13612
|
+
"oocLabel": "rp_NFPimG_oocLabel",
|
|
12652
13613
|
"oocRefused": "rp_NFPimG_oocRefused",
|
|
13614
|
+
"sceneImage": "rp_NFPimG_sceneImage",
|
|
12653
13615
|
"words": "rp_NFPimG_words",
|
|
13616
|
+
"avatar": "rp_NFPimG_avatar",
|
|
13617
|
+
"images": "rp_NFPimG_images",
|
|
13618
|
+
"imageError": "rp_NFPimG_imageError",
|
|
13619
|
+
"playAll": "rp_NFPimG_playAll",
|
|
12654
13620
|
"name": "rp_NFPimG_name",
|
|
12655
13621
|
"narration": "rp_NFPimG_narration",
|
|
12656
|
-
"avatar": "rp_NFPimG_avatar",
|
|
12657
|
-
"sceneImage": "rp_NFPimG_sceneImage",
|
|
12658
13622
|
"oocNote": "rp_NFPimG_oocNote",
|
|
12659
|
-
"playLine": "rp_NFPimG_playLine",
|
|
12660
|
-
"note": "rp_NFPimG_note",
|
|
12661
|
-
"line": "rp_NFPimG_line",
|
|
12662
|
-
"playAll": "rp_NFPimG_playAll",
|
|
12663
13623
|
"imageButton": "rp_NFPimG_imageButton",
|
|
12664
|
-
"
|
|
12665
|
-
"imageStatus": "rp_NFPimG_imageStatus",
|
|
12666
|
-
"oocLabel": "rp_NFPimG_oocLabel",
|
|
12667
|
-
"imageError": "rp_NFPimG_imageError"
|
|
13624
|
+
"imageStatus": "rp_NFPimG_imageStatus"
|
|
12668
13625
|
};
|
|
12669
13626
|
//#endregion
|
|
12670
13627
|
//#region src/client/transcript/PreviewNode.tsx
|
|
@@ -12739,7 +13696,11 @@ window.__ModuleLoader__.load({
|
|
|
12739
13696
|
onClick: () => {
|
|
12740
13697
|
play(data.segments);
|
|
12741
13698
|
},
|
|
12742
|
-
children: [
|
|
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
|
+
]
|
|
12743
13704
|
}),
|
|
12744
13705
|
data.ooc !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
12745
13706
|
className: data.ooc.legal ? NarrationView_module_css_default.oocNote : NarrationView_module_css_default.oocRefused,
|
|
@@ -12777,11 +13738,12 @@ window.__ModuleLoader__.load({
|
|
|
12777
13738
|
type: "button",
|
|
12778
13739
|
className: NarrationView_module_css_default.playLine,
|
|
12779
13740
|
disabled: playing,
|
|
13741
|
+
"aria-label": t("speakLine"),
|
|
12780
13742
|
title: t("speakLine"),
|
|
12781
13743
|
onClick: () => {
|
|
12782
13744
|
play([segment]);
|
|
12783
13745
|
},
|
|
12784
|
-
children: "
|
|
13746
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { "aria-hidden": "true" })
|
|
12785
13747
|
})]
|
|
12786
13748
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12787
13749
|
className: NarrationView_module_css_default.words,
|
|
@@ -12898,7 +13860,7 @@ window.__ModuleLoader__.load({
|
|
|
12898
13860
|
}
|
|
12899
13861
|
//#endregion
|
|
12900
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
|
|
12901
|
-
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
|
|
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}}";
|
|
12902
13864
|
const key$1 = "src/client/transcript/SuggestionsDock.module.css";
|
|
12903
13865
|
let tag$1 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$1) + "]");
|
|
12904
13866
|
if (tag$1 === null) {
|
|
@@ -12909,10 +13871,10 @@ window.__ModuleLoader__.load({
|
|
|
12909
13871
|
}
|
|
12910
13872
|
tag$1.textContent = css$1;
|
|
12911
13873
|
var SuggestionsDock_module_css_default = {
|
|
12912
|
-
"dock": "rp_rWH4DG_dock",
|
|
12913
13874
|
"lines": "rp_rWH4DG_lines",
|
|
12914
|
-
"
|
|
13875
|
+
"dock": "rp_rWH4DG_dock",
|
|
12915
13876
|
"chip": "rp_rWH4DG_chip",
|
|
13877
|
+
"label": "rp_rWH4DG_label",
|
|
12916
13878
|
"card": "rp_rWH4DG_card"
|
|
12917
13879
|
};
|
|
12918
13880
|
//#endregion
|
|
@@ -13013,7 +13975,7 @@ window.__ModuleLoader__.load({
|
|
|
13013
13975
|
}
|
|
13014
13976
|
//#endregion
|
|
13015
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
|
|
13016
|
-
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
|
|
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}}";
|
|
13017
13979
|
const key = "src/client/transcript/TurnsDock.module.css";
|
|
13018
13980
|
let tag = document.querySelector("style[data-plugin-css=" + JSON.stringify(key) + "]");
|
|
13019
13981
|
if (tag === null) {
|
|
@@ -13024,12 +13986,12 @@ window.__ModuleLoader__.load({
|
|
|
13024
13986
|
}
|
|
13025
13987
|
tag.textContent = css;
|
|
13026
13988
|
var TurnsDock_module_css_default = {
|
|
13027
|
-
"
|
|
13028
|
-
"dock": "rp_f4YLlq_dock",
|
|
13989
|
+
"error": "rp_f4YLlq_error",
|
|
13029
13990
|
"button": "rp_f4YLlq_button",
|
|
13991
|
+
"dock": "rp_f4YLlq_dock",
|
|
13992
|
+
"group": "rp_f4YLlq_group",
|
|
13030
13993
|
"count": "rp_f4YLlq_count",
|
|
13031
|
-
"
|
|
13032
|
-
"group": "rp_f4YLlq_group"
|
|
13994
|
+
"select": "rp_f4YLlq_select"
|
|
13033
13995
|
};
|
|
13034
13996
|
//#endregion
|
|
13035
13997
|
//#region src/client/transcript/withdrawn.ts
|
|
@@ -13300,6 +14262,7 @@ window.__ModuleLoader__.load({
|
|
|
13300
14262
|
const id = roleplaySessionOf(chat);
|
|
13301
14263
|
if (id === void 0) throw new Error("this chat is not a roleplay session");
|
|
13302
14264
|
const response = await fetch(`roleplay-api/sessions/timeline?id=${encodeURIComponent(id)}`);
|
|
14265
|
+
if (response.status === 404) return void 0;
|
|
13303
14266
|
if (!response.ok) throw new Error(`the turns could not be read (${response.status})`);
|
|
13304
14267
|
const view = await response.json();
|
|
13305
14268
|
return {
|