@dsh-agentic-roleplay/core 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -37,8 +37,8 @@ window.__ModuleLoader__.load({
37
37
  }
38
38
  tag$26.textContent = css$26;
39
39
  var PageTabs_module_css_default = {
40
- "tabs": "rp_Poldga_tabs",
41
- "tab": "rp_Poldga_tab"
40
+ "tab": "rp_Poldga_tab",
41
+ "tabs": "rp_Poldga_tabs"
42
42
  };
43
43
  //#endregion
44
44
  //#region src/client/panel/PageTabs.tsx
@@ -94,8 +94,8 @@ window.__ModuleLoader__.load({
94
94
  tag$25.textContent = css$25;
95
95
  var RoleplayPanel_module_css_default = {
96
96
  "title": "rp_ua5gBa_title",
97
- "body": "rp_ua5gBa_body",
98
97
  "panel": "rp_ua5gBa_panel",
98
+ "body": "rp_ua5gBa_body",
99
99
  "header": "rp_ua5gBa_header"
100
100
  };
101
101
  //#endregion
@@ -745,40 +745,40 @@ window.__ModuleLoader__.load({
745
745
  }
746
746
  tag$24.textContent = css$24;
747
747
  var CharactersPanel_module_css_default = {
748
- "voiceInline": "rp_5ZMIxq_voiceInline",
748
+ "section": "rp_5ZMIxq_section",
749
+ "bar": "rp_5ZMIxq_bar",
750
+ "meta": "rp_5ZMIxq_meta",
751
+ "body": "rp_5ZMIxq_body",
752
+ "placeholder": "rp_5ZMIxq_placeholder",
753
+ "missing": "rp_5ZMIxq_missing",
754
+ "empty": "rp_5ZMIxq_empty",
749
755
  "help": "rp_5ZMIxq_help",
750
- "field": "rp_5ZMIxq_field",
751
- "tabsSpace": "rp_5ZMIxq_tabsSpace",
756
+ "voiceInline": "rp_5ZMIxq_voiceInline",
757
+ "wide": "rp_5ZMIxq_wide",
752
758
  "error": "rp_5ZMIxq_error",
753
- "empty": "rp_5ZMIxq_empty",
754
- "grid": "rp_5ZMIxq_grid",
759
+ "field": "rp_5ZMIxq_field",
760
+ "initial": "rp_5ZMIxq_initial",
761
+ "area": "rp_5ZMIxq_area",
762
+ "nameInput": "rp_5ZMIxq_nameInput",
755
763
  "head": "rp_5ZMIxq_head",
764
+ "select": "rp_5ZMIxq_select",
765
+ "portraitHint": "rp_5ZMIxq_portraitHint",
766
+ "label": "rp_5ZMIxq_label",
767
+ "portrait": "rp_5ZMIxq_portrait",
768
+ "goal": "rp_5ZMIxq_goal",
769
+ "grid": "rp_5ZMIxq_grid",
756
770
  "row": "rp_5ZMIxq_row",
757
- "portraitError": "rp_5ZMIxq_portraitError",
758
771
  "sheet": "rp_5ZMIxq_sheet",
759
- "portraitBox": "rp_5ZMIxq_portraitBox",
760
- "placeholder": "rp_5ZMIxq_placeholder",
772
+ "tabOn": "rp_5ZMIxq_tabOn",
761
773
  "portraitAction": "rp_5ZMIxq_portraitAction",
762
- "wide": "rp_5ZMIxq_wide",
763
- "panel": "rp_5ZMIxq_panel",
764
- "initial": "rp_5ZMIxq_initial",
765
- "section": "rp_5ZMIxq_section",
766
774
  "sectionTitle": "rp_5ZMIxq_sectionTitle",
767
- "goal": "rp_5ZMIxq_goal",
775
+ "tabsSpace": "rp_5ZMIxq_tabsSpace",
768
776
  "barText": "rp_5ZMIxq_barText",
769
- "nameInput": "rp_5ZMIxq_nameInput",
770
- "tabOn": "rp_5ZMIxq_tabOn",
771
- "area": "rp_5ZMIxq_area",
777
+ "panel": "rp_5ZMIxq_panel",
778
+ "portraitError": "rp_5ZMIxq_portraitError",
772
779
  "tab": "rp_5ZMIxq_tab",
773
- "missing": "rp_5ZMIxq_missing",
774
- "bar": "rp_5ZMIxq_bar",
775
- "select": "rp_5ZMIxq_select",
776
- "meta": "rp_5ZMIxq_meta",
777
- "portrait": "rp_5ZMIxq_portrait",
778
- "body": "rp_5ZMIxq_body",
779
- "label": "rp_5ZMIxq_label",
780
- "tabs": "rp_5ZMIxq_tabs",
781
- "portraitHint": "rp_5ZMIxq_portraitHint"
780
+ "portraitBox": "rp_5ZMIxq_portraitBox",
781
+ "tabs": "rp_5ZMIxq_tabs"
782
782
  };
783
783
  //#endregion
784
784
  //#region src/client/world-editor/EditorTabs.tsx
@@ -2390,39 +2390,39 @@ window.__ModuleLoader__.load({
2390
2390
  }
2391
2391
  tag$23.textContent = css$23;
2392
2392
  var RelationsPanel_module_css_default = {
2393
+ "graphEdge": "rp_7pEHTW_graphEdge",
2394
+ "graphInspector": "rp_7pEHTW_graphInspector",
2395
+ "list": "rp_7pEHTW_list",
2396
+ "node_faction": "rp_7pEHTW_node_faction",
2397
+ "check": "rp_7pEHTW_check",
2398
+ "entities": "rp_7pEHTW_entities",
2399
+ "wide": "rp_7pEHTW_wide",
2400
+ "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2401
+ "inspector": "rp_7pEHTW_inspector",
2402
+ "filterOn": "rp_7pEHTW_filterOn",
2393
2403
  "space": "rp_7pEHTW_space",
2394
- "head": "rp_7pEHTW_head",
2395
- "edge": "rp_7pEHTW_edge",
2404
+ "empty": "rp_7pEHTW_empty",
2405
+ "edgeKind": "rp_7pEHTW_edgeKind",
2406
+ "form": "rp_7pEHTW_form",
2396
2407
  "filter": "rp_7pEHTW_filter",
2397
- "edgeTitle": "rp_7pEHTW_edgeTitle",
2408
+ "actions": "rp_7pEHTW_actions",
2409
+ "perspective": "rp_7pEHTW_perspective",
2410
+ "node_location": "rp_7pEHTW_node_location",
2398
2411
  "edgeOn": "rp_7pEHTW_edgeOn",
2399
- "form": "rp_7pEHTW_form",
2400
- "wide": "rp_7pEHTW_wide",
2401
- "notice": "rp_7pEHTW_notice",
2402
- "graph": "rp_7pEHTW_graph",
2403
2412
  "node": "rp_7pEHTW_node",
2404
- "panel": "rp_7pEHTW_panel",
2405
- "graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
2406
- "node_character": "rp_7pEHTW_node_character",
2407
- "error": "rp_7pEHTW_error",
2408
2413
  "toolbar": "rp_7pEHTW_toolbar",
2409
- "entities": "rp_7pEHTW_entities",
2410
- "node_faction": "rp_7pEHTW_node_faction",
2411
- "perspective": "rp_7pEHTW_perspective",
2412
- "workspace": "rp_7pEHTW_workspace",
2413
- "actions": "rp_7pEHTW_actions",
2414
- "status": "rp_7pEHTW_status",
2415
- "empty": "rp_7pEHTW_empty",
2416
- "filterOn": "rp_7pEHTW_filterOn",
2417
- "list": "rp_7pEHTW_list",
2418
- "node_location": "rp_7pEHTW_node_location",
2419
- "inspector": "rp_7pEHTW_inspector",
2420
- "edgeKind": "rp_7pEHTW_edgeKind",
2421
- "check": "rp_7pEHTW_check",
2414
+ "graph": "rp_7pEHTW_graph",
2422
2415
  "node_item": "rp_7pEHTW_node_item",
2423
- "graphInspector": "rp_7pEHTW_graphInspector",
2416
+ "panel": "rp_7pEHTW_panel",
2417
+ "notice": "rp_7pEHTW_notice",
2418
+ "workspace": "rp_7pEHTW_workspace",
2424
2419
  "metrics": "rp_7pEHTW_metrics",
2425
- "graphEdge": "rp_7pEHTW_graphEdge"
2420
+ "status": "rp_7pEHTW_status",
2421
+ "edgeTitle": "rp_7pEHTW_edgeTitle",
2422
+ "error": "rp_7pEHTW_error",
2423
+ "edge": "rp_7pEHTW_edge",
2424
+ "node_character": "rp_7pEHTW_node_character",
2425
+ "head": "rp_7pEHTW_head"
2426
2426
  };
2427
2427
  //#endregion
2428
2428
  //#region src/client/world-editor/RelationsPanel.tsx
@@ -3750,12 +3750,12 @@ window.__ModuleLoader__.load({
3750
3750
  }
3751
3751
  tag$22.textContent = css$22;
3752
3752
  var PackFrame_module_css_default = {
3753
- "message": "rp_h_sbFq_message",
3754
- "frame": "rp_h_sbFq_frame",
3755
3753
  "problems": "rp_h_sbFq_problems",
3754
+ "message": "rp_h_sbFq_message",
3756
3755
  "hud": "rp_h_sbFq_hud",
3757
- "fill": "rp_h_sbFq_fill",
3758
- "tab": "rp_h_sbFq_tab"
3756
+ "frame": "rp_h_sbFq_frame",
3757
+ "tab": "rp_h_sbFq_tab",
3758
+ "fill": "rp_h_sbFq_fill"
3759
3759
  };
3760
3760
  //#endregion
3761
3761
  //#region src/client/widgets/pack-frame/theme.ts
@@ -3987,6 +3987,19 @@ window.__ModuleLoader__.load({
3987
3987
  const saveVariables = async (world, variables, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/variables?${query(world)}`, init("PUT", signal, { variables })));
3988
3988
  const loadWorldPacks = async (world, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface?${query(world)}`, init("GET", signal)));
3989
3989
  const loadPackPreview = async (world, pack, signal) => await read$2(await fetch(`${API_PREFIX}/worlds/interface/preview?${query(world)}&pack=${encodeURIComponent(pack)}`, init("GET", signal)));
3990
+ /** The playable characters of an authored world, for choosing whom an opening is for. */
3991
+ async function loadPlayable(worldId, signal) {
3992
+ const response = await fetch(`${API_PREFIX}/worlds/characters?id=${encodeURIComponent(worldId)}`, {
3993
+ credentials: "same-origin",
3994
+ signal
3995
+ });
3996
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`.trim());
3997
+ const { characters } = await response.json();
3998
+ return characters.filter((character) => character.role === "playable").map(({ id, name }) => ({
3999
+ id,
4000
+ name
4001
+ }));
4002
+ }
3990
4003
  //#endregion
3991
4004
  //#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/PacksPanel.module.css.mjs
3992
4005
  const css$21 = ".rp_FLaP7q_controls{flex-wrap:wrap;align-items:center;gap:8px 16px;margin:8px 0;display:flex}.rp_FLaP7q_group{color:var(--dsw-alias-label-tertiary);align-items:center;gap:4px;font-size:12px;display:inline-flex}.rp_FLaP7q_stage{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);max-width:100%;overflow:hidden}.rp_FLaP7q_stageTall{height:420px}.rp_FLaP7q_log{color:var(--dsw-alias-label-secondary);margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_files{columns:2 220px;margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_note{color:var(--dsw-alias-label-tertiary);font-size:12px}";
@@ -4001,10 +4014,10 @@ window.__ModuleLoader__.load({
4001
4014
  tag$21.textContent = css$21;
4002
4015
  var PacksPanel_module_css_default = {
4003
4016
  "note": "rp_FLaP7q_note",
4017
+ "stageTall": "rp_FLaP7q_stageTall",
4018
+ "controls": "rp_FLaP7q_controls",
4004
4019
  "group": "rp_FLaP7q_group",
4005
4020
  "stage": "rp_FLaP7q_stage",
4006
- "controls": "rp_FLaP7q_controls",
4007
- "stageTall": "rp_FLaP7q_stageTall",
4008
4021
  "log": "rp_FLaP7q_log",
4009
4022
  "files": "rp_FLaP7q_files"
4010
4023
  };
@@ -4477,7 +4490,8 @@ window.__ModuleLoader__.load({
4477
4490
  if (JSON.stringify(lines(draft.rules)) !== JSON.stringify(lines(saved.rules))) edit["rules"] = lines(draft.rules);
4478
4491
  const cleaned = (list) => list.map((entry) => ({
4479
4492
  title: entry.title.trim(),
4480
- text: entry.text.trim()
4493
+ text: entry.text.trim(),
4494
+ ...(entry.character ?? "") === "" ? {} : { character: entry.character }
4481
4495
  })).filter((entry) => entry.text !== "");
4482
4496
  if (JSON.stringify(cleaned(draft.alternates)) !== JSON.stringify(cleaned(saved.alternates))) edit["alternateOpenings"] = cleaned(draft.alternates);
4483
4497
  return edit;
@@ -4488,6 +4502,14 @@ window.__ModuleLoader__.load({
4488
4502
  const [saved, setSaved] = (0, react.useState)();
4489
4503
  const [draft, setDraft] = (0, react.useState)();
4490
4504
  const [status, setStatus] = (0, react.useState)({ state: "idle" });
4505
+ const [playable, setPlayable] = (0, react.useState)([]);
4506
+ (0, react.useEffect)(() => {
4507
+ const abort = new AbortController();
4508
+ loadPlayable(worldId, abort.signal).then(setPlayable, () => void 0);
4509
+ return () => {
4510
+ abort.abort();
4511
+ };
4512
+ }, [worldId]);
4491
4513
  (0, react.useEffect)(() => {
4492
4514
  const abort = new AbortController();
4493
4515
  loadInfo(worldId, abort.signal).then((value) => {
@@ -4673,6 +4695,36 @@ window.__ModuleLoader__.load({
4673
4695
  }
4674
4696
  })]
4675
4697
  }),
4698
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4699
+ className: CharactersPanel_module_css_default.field,
4700
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4701
+ className: CharactersPanel_module_css_default.label,
4702
+ children: t("infoAlternateFor")
4703
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4704
+ className: CharactersPanel_module_css_default.select,
4705
+ value: entry.character ?? "",
4706
+ onChange: (event) => {
4707
+ setAlternates(draft.alternates.map((item, at) => at === index ? {
4708
+ ...item,
4709
+ character: event.target.value
4710
+ } : item));
4711
+ },
4712
+ children: [
4713
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4714
+ value: "",
4715
+ children: t("infoAlternateAny")
4716
+ }),
4717
+ playable.map((character) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4718
+ value: character.id,
4719
+ children: character.name
4720
+ }, character.id)),
4721
+ entry.character !== void 0 && entry.character !== "" && !playable.some((character) => character.id === entry.character) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4722
+ value: entry.character,
4723
+ children: entry.character
4724
+ })
4725
+ ]
4726
+ })]
4727
+ }),
4676
4728
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4677
4729
  variant: "ghost",
4678
4730
  size: "sm",
@@ -5496,6 +5548,41 @@ window.__ModuleLoader__.load({
5496
5548
  id: "list_checks",
5497
5549
  agent: "gameMaster",
5498
5550
  default: true
5551
+ },
5552
+ {
5553
+ id: "recall_my_memories",
5554
+ agent: "characters",
5555
+ default: true
5556
+ },
5557
+ {
5558
+ id: "recall_my_known_entities",
5559
+ agent: "characters",
5560
+ default: true
5561
+ },
5562
+ {
5563
+ id: "recall_my_lore",
5564
+ agent: "characters",
5565
+ default: true
5566
+ },
5567
+ {
5568
+ id: "search_events",
5569
+ agent: "records",
5570
+ default: true
5571
+ },
5572
+ {
5573
+ id: "list_threads",
5574
+ agent: "records",
5575
+ default: true
5576
+ },
5577
+ {
5578
+ id: "list_relationships",
5579
+ agent: "records",
5580
+ default: true
5581
+ },
5582
+ {
5583
+ id: "list_items",
5584
+ agent: "records",
5585
+ default: true
5499
5586
  }
5500
5587
  ];
5501
5588
  /** Whether an agent of this kind has a tool, by what the switches say and, failing that, by default. A tool this version does not offer is never on. */
@@ -5564,17 +5651,17 @@ window.__ModuleLoader__.load({
5564
5651
  }
5565
5652
  tag$20.textContent = css$20;
5566
5653
  var ToolSwitches_module_css_default = {
5654
+ "default": "rp_CjoFLq_default",
5567
5655
  "external": "rp_CjoFLq_external",
5568
5656
  "title": "rp_CjoFLq_title",
5569
- "tool": "rp_CjoFLq_tool",
5570
- "agent": "rp_CjoFLq_agent",
5571
5657
  "agentName": "rp_CjoFLq_agentName",
5572
5658
  "toolText": "rp_CjoFLq_toolText",
5573
- "help": "rp_CjoFLq_help",
5574
- "hint": "rp_CjoFLq_hint",
5659
+ "tool": "rp_CjoFLq_tool",
5660
+ "error": "rp_CjoFLq_error",
5575
5661
  "root": "rp_CjoFLq_root",
5576
- "default": "rp_CjoFLq_default",
5577
- "error": "rp_CjoFLq_error"
5662
+ "agent": "rp_CjoFLq_agent",
5663
+ "hint": "rp_CjoFLq_hint",
5664
+ "help": "rp_CjoFLq_help"
5578
5665
  };
5579
5666
  //#endregion
5580
5667
  //#region src/client/widgets/tool-switches/ToolSwitches.tsx
@@ -6583,35 +6670,35 @@ window.__ModuleLoader__.load({
6583
6670
  }
6584
6671
  tag$19.textContent = css$19;
6585
6672
  var GalleryView_module_css_default = {
6586
- "pre": "rp_9pSHmG_pre",
6673
+ "edit": "rp_9pSHmG_edit",
6674
+ "select": "rp_9pSHmG_select",
6675
+ "status": "rp_9pSHmG_status",
6676
+ "thumb": "rp_9pSHmG_thumb",
6677
+ "editInput": "rp_9pSHmG_editInput",
6678
+ "message": "rp_9pSHmG_message",
6679
+ "editLabel": "rp_9pSHmG_editLabel",
6680
+ "reusable": "rp_9pSHmG_reusable",
6681
+ "editArea": "rp_9pSHmG_editArea",
6682
+ "editHelp": "rp_9pSHmG_editHelp",
6683
+ "actions": "rp_9pSHmG_actions",
6587
6684
  "error": "rp_9pSHmG_error",
6588
- "large": "rp_9pSHmG_large",
6685
+ "note": "rp_9pSHmG_note",
6589
6686
  "facts": "rp_9pSHmG_facts",
6590
- "editButton": "rp_9pSHmG_editButton",
6591
- "editField": "rp_9pSHmG_editField",
6687
+ "caption": "rp_9pSHmG_caption",
6592
6688
  "cell": "rp_9pSHmG_cell",
6593
- "editArea": "rp_9pSHmG_editArea",
6594
- "count": "rp_9pSHmG_count",
6595
- "thumb": "rp_9pSHmG_thumb",
6596
- "editHelp": "rp_9pSHmG_editHelp",
6597
- "grid": "rp_9pSHmG_grid",
6598
- "status": "rp_9pSHmG_status",
6599
- "open": "rp_9pSHmG_open",
6600
- "reusable": "rp_9pSHmG_reusable",
6689
+ "editField": "rp_9pSHmG_editField",
6601
6690
  "detail": "rp_9pSHmG_detail",
6602
- "tags": "rp_9pSHmG_tags",
6603
- "toolbar": "rp_9pSHmG_toolbar",
6604
- "note": "rp_9pSHmG_note",
6605
- "edit": "rp_9pSHmG_edit",
6606
6691
  "page": "rp_9pSHmG_page",
6607
- "editLabel": "rp_9pSHmG_editLabel",
6608
- "message": "rp_9pSHmG_message",
6692
+ "count": "rp_9pSHmG_count",
6693
+ "grid": "rp_9pSHmG_grid",
6609
6694
  "image": "rp_9pSHmG_image",
6610
- "caption": "rp_9pSHmG_caption",
6611
- "editInput": "rp_9pSHmG_editInput",
6695
+ "large": "rp_9pSHmG_large",
6696
+ "pre": "rp_9pSHmG_pre",
6697
+ "toolbar": "rp_9pSHmG_toolbar",
6698
+ "tags": "rp_9pSHmG_tags",
6699
+ "editButton": "rp_9pSHmG_editButton",
6612
6700
  "statusError": "rp_9pSHmG_statusError",
6613
- "actions": "rp_9pSHmG_actions",
6614
- "select": "rp_9pSHmG_select"
6701
+ "open": "rp_9pSHmG_open"
6615
6702
  };
6616
6703
  //#endregion
6617
6704
  //#region src/client/widgets/gallery-view/GalleryView.tsx
@@ -6952,12 +7039,12 @@ window.__ModuleLoader__.load({
6952
7039
  }
6953
7040
  tag$18.textContent = css$18;
6954
7041
  var WorldEditor_module_css_default = {
7042
+ "drawer": "rp__swA3a_drawer",
7043
+ "content": "rp__swA3a_content",
7044
+ "view": "rp__swA3a_view",
6955
7045
  "warning": "rp__swA3a_warning",
6956
7046
  "drawerItem": "rp__swA3a_drawerItem",
6957
- "view": "rp__swA3a_view",
6958
- "drawer": "rp__swA3a_drawer",
6959
7047
  "drawerItemOn": "rp__swA3a_drawerItemOn",
6960
- "content": "rp__swA3a_content",
6961
7048
  "message": "rp__swA3a_message"
6962
7049
  };
6963
7050
  //#endregion
@@ -7352,27 +7439,27 @@ window.__ModuleLoader__.load({
7352
7439
  }
7353
7440
  tag$17.textContent = css$17;
7354
7441
  var AvatarsPage_module_css_default = {
7355
- "error": "rp_pQOzEG_error",
7356
- "actions": "rp_pQOzEG_actions",
7357
- "placeholder": "rp_pQOzEG_placeholder",
7358
- "name": "rp_pQOzEG_name",
7359
- "grid": "rp_pQOzEG_grid",
7360
- "editTitle": "rp_pQOzEG_editTitle",
7442
+ "field": "rp_pQOzEG_field",
7361
7443
  "viewport": "rp_pQOzEG_viewport",
7444
+ "page": "rp_pQOzEG_page",
7362
7445
  "count": "rp_pQOzEG_count",
7363
- "card": "rp_pQOzEG_card",
7446
+ "actions": "rp_pQOzEG_actions",
7447
+ "name": "rp_pQOzEG_name",
7364
7448
  "message": "rp_pQOzEG_message",
7449
+ "editTitle": "rp_pQOzEG_editTitle",
7450
+ "open": "rp_pQOzEG_open",
7365
7451
  "form": "rp_pQOzEG_form",
7366
- "page": "rp_pQOzEG_page",
7452
+ "label": "rp_pQOzEG_label",
7453
+ "card": "rp_pQOzEG_card",
7367
7454
  "portrait": "rp_pQOzEG_portrait",
7455
+ "summary": "rp_pQOzEG_summary",
7456
+ "text": "rp_pQOzEG_text",
7457
+ "grid": "rp_pQOzEG_grid",
7458
+ "placeholder": "rp_pQOzEG_placeholder",
7368
7459
  "editHeader": "rp_pQOzEG_editHeader",
7369
- "label": "rp_pQOzEG_label",
7370
- "toolbar": "rp_pQOzEG_toolbar",
7371
- "open": "rp_pQOzEG_open",
7460
+ "error": "rp_pQOzEG_error",
7372
7461
  "editBody": "rp_pQOzEG_editBody",
7373
- "text": "rp_pQOzEG_text",
7374
- "summary": "rp_pQOzEG_summary",
7375
- "field": "rp_pQOzEG_field"
7462
+ "toolbar": "rp_pQOzEG_toolbar"
7376
7463
  };
7377
7464
  //#endregion
7378
7465
  //#region src/client/pages/avatars/AvatarsPage.tsx
@@ -7676,7 +7763,21 @@ window.__ModuleLoader__.load({
7676
7763
  sw_tool_roll_dice: "Roll dice",
7677
7764
  sw_tool_roll_dice_hint: "Rolls plain dice (2d6+1, d100) for what has no check, so that no number is made up.",
7678
7765
  sw_tool_list_checks: "List checks",
7679
- sw_tool_list_checks_hint: "Shows the world's checks and when each is used."
7766
+ sw_tool_list_checks_hint: "Shows the world's checks and when each is used.",
7767
+ sw_tool_recall_my_memories: "Recall memories",
7768
+ sw_tool_recall_my_memories_hint: "Lets a character look up what it remembers when the scene names something its brief left out.",
7769
+ sw_tool_recall_my_known_entities: "Recall known places and things",
7770
+ sw_tool_recall_my_known_entities_hint: "Lets a character look up the places, things and people it knows of.",
7771
+ sw_tool_recall_my_lore: "Recall lore",
7772
+ sw_tool_recall_my_lore_hint: "Lets a character read the canon it explicitly knows.",
7773
+ sw_tool_search_events: "Search events",
7774
+ sw_tool_search_events_hint: "Lets the record keeper search what already happened before it writes.",
7775
+ sw_tool_list_threads: "List open threads",
7776
+ sw_tool_list_threads_hint: "Lets the record keeper see the story threads that are still open.",
7777
+ sw_tool_list_relationships: "List relationships",
7778
+ sw_tool_list_relationships_hint: "Lets the record keeper see how characters stand with each other.",
7779
+ sw_tool_list_items: "List things",
7780
+ sw_tool_list_items_hint: "Lets the record keeper see the things in the story and where they are."
7680
7781
  },
7681
7782
  zh: {
7682
7783
  sw_title: "工具",
@@ -7698,7 +7799,21 @@ window.__ModuleLoader__.load({
7698
7799
  sw_tool_roll_dice: "掷骰子",
7699
7800
  sw_tool_roll_dice_hint: "为没有检定的事掷普通骰子(2d6+1、d100),不让任何数字被编造。",
7700
7801
  sw_tool_list_checks: "列出检定",
7701
- sw_tool_list_checks_hint: "显示世界的检定以及各自的使用场合。"
7802
+ sw_tool_list_checks_hint: "显示世界的检定以及各自的使用场合。",
7803
+ sw_tool_recall_my_memories: "回忆往事",
7804
+ sw_tool_recall_my_memories_hint: "当场景提到简报中没有的内容时,角色可以查阅自己记得的事。",
7805
+ sw_tool_recall_my_known_entities: "回忆所知的地点与事物",
7806
+ sw_tool_recall_my_known_entities_hint: "角色可以查阅自己知道的地点、物品和人物。",
7807
+ sw_tool_recall_my_lore: "回忆典故",
7808
+ sw_tool_recall_my_lore_hint: "角色可以阅读自己明确知道的设定。",
7809
+ sw_tool_search_events: "搜索事件",
7810
+ sw_tool_search_events_hint: "记录员在写入前可以搜索已经发生的事。",
7811
+ sw_tool_list_threads: "列出未了线索",
7812
+ sw_tool_list_threads_hint: "记录员可以查看仍未了结的故事线索。",
7813
+ sw_tool_list_relationships: "列出关系",
7814
+ sw_tool_list_relationships_hint: "记录员可以查看角色之间的关系。",
7815
+ sw_tool_list_items: "列出物品",
7816
+ sw_tool_list_items_hint: "记录员可以查看故事中的物品及其位置。"
7702
7817
  }
7703
7818
  };
7704
7819
  //#endregion
@@ -7860,6 +7975,8 @@ window.__ModuleLoader__.load({
7860
7975
  variableVisibility_public: "Anyone present",
7861
7976
  variableVisibility_private: "Only itself",
7862
7977
  variableVisibility_hidden: "Nobody (game master only)",
7978
+ infoAlternateFor: "For",
7979
+ infoAlternateAny: "Any character",
7863
7980
  infoAlternates: "Other openings",
7864
7981
  infoAlternatesHelp: "Other ways the story can begin. The player picks one when starting a session; each is one narration, shown instead of the opening message.",
7865
7982
  infoAlternateTitle: "Title",
@@ -8133,6 +8250,8 @@ window.__ModuleLoader__.load({
8133
8250
  variableVisibility_public: "在场者皆可",
8134
8251
  variableVisibility_private: "仅自己",
8135
8252
  variableVisibility_hidden: "无人(仅主持人)",
8253
+ infoAlternateFor: "适用于",
8254
+ infoAlternateAny: "任何角色",
8136
8255
  infoAlternates: "其他开场",
8137
8256
  infoAlternatesHelp: "故事的其他开始方式。玩家开始会话时选择其一;每个都是一段叙述,会代替开场白显示。",
8138
8257
  infoAlternateTitle: "标题",
@@ -8767,10 +8886,10 @@ window.__ModuleLoader__.load({
8767
8886
  }
8768
8887
  tag$14.textContent = css$14;
8769
8888
  var DeleteSessionDialog_module_css_default = {
8770
- "error": "rp_FifHrW_error",
8771
8889
  "warning": "rp_FifHrW_warning",
8890
+ "body": "rp_FifHrW_body",
8772
8891
  "question": "rp_FifHrW_question",
8773
- "body": "rp_FifHrW_body"
8892
+ "error": "rp_FifHrW_error"
8774
8893
  };
8775
8894
  //#endregion
8776
8895
  //#region src/client/pages/sessions/DeleteSessionDialog.tsx
@@ -8877,28 +8996,28 @@ window.__ModuleLoader__.load({
8877
8996
  }
8878
8997
  tag$13.textContent = css$13;
8879
8998
  var SessionsPage_module_css_default = {
8880
- "turnsColumn": "rp_24z4eW_turnsColumn",
8881
- "nameColumn": "rp_24z4eW_nameColumn",
8882
8999
  "archived": "rp_24z4eW_archived",
8883
- "notice": "rp_24z4eW_notice",
8884
- "actionsColumn": "rp_24z4eW_actionsColumn",
9000
+ "fits": "rp_24z4eW_fits",
8885
9001
  "actions": "rp_24z4eW_actions",
8886
- "spinning": "rp_24z4eW_spinning",
9002
+ "nameColumn": "rp_24z4eW_nameColumn",
9003
+ "scrolls": "rp_24z4eW_scrolls",
8887
9004
  "toolbar": "rp_24z4eW_toolbar",
9005
+ "secondary": "rp_24z4eW_secondary",
8888
9006
  "table": "rp_24z4eW_table",
8889
9007
  "viewport": "rp_24z4eW_viewport",
8890
- "fits": "rp_24z4eW_fits",
9008
+ "name": "rp_24z4eW_name",
8891
9009
  "timeColumn": "rp_24z4eW_timeColumn",
8892
- "scrolls": "rp_24z4eW_scrolls",
8893
- "badge": "rp_24z4eW_badge",
9010
+ "message": "rp_24z4eW_message",
9011
+ "notice": "rp_24z4eW_notice",
9012
+ "actionsColumn": "rp_24z4eW_actionsColumn",
9013
+ "spin": "rp_24z4eW_spin",
9014
+ "spinning": "rp_24z4eW_spinning",
8894
9015
  "page": "rp_24z4eW_page",
8895
9016
  "worldColumn": "rp_24z4eW_worldColumn",
8896
- "name": "rp_24z4eW_name",
8897
- "secondary": "rp_24z4eW_secondary",
8898
- "count": "rp_24z4eW_count",
8899
- "spin": "rp_24z4eW_spin",
8900
9017
  "number": "rp_24z4eW_number",
8901
- "message": "rp_24z4eW_message"
9018
+ "badge": "rp_24z4eW_badge",
9019
+ "count": "rp_24z4eW_count",
9020
+ "turnsColumn": "rp_24z4eW_turnsColumn"
8902
9021
  };
8903
9022
  //#endregion
8904
9023
  //#region src/client/pages/sessions/SessionsPage.tsx
@@ -9414,16 +9533,16 @@ window.__ModuleLoader__.load({
9414
9533
  }
9415
9534
  tag$12.textContent = css$12;
9416
9535
  var WorldCard_module_css_default = {
9536
+ "openButton": "rp_Bvxx5q_openButton",
9537
+ "tags": "rp_Bvxx5q_tags",
9538
+ "card": "rp_Bvxx5q_card",
9539
+ "name": "rp_Bvxx5q_name",
9417
9540
  "placeholder": "rp_Bvxx5q_placeholder",
9418
9541
  "play": "rp_Bvxx5q_play",
9419
- "openButton": "rp_Bvxx5q_openButton",
9542
+ "cover": "rp_Bvxx5q_cover",
9420
9543
  "image": "rp_Bvxx5q_image",
9421
9544
  "tag": "rp_Bvxx5q_tag",
9422
- "cover": "rp_Bvxx5q_cover",
9423
- "card": "rp_Bvxx5q_card",
9424
- "tags": "rp_Bvxx5q_tags",
9425
- "info": "rp_Bvxx5q_info",
9426
- "name": "rp_Bvxx5q_name"
9545
+ "info": "rp_Bvxx5q_info"
9427
9546
  };
9428
9547
  //#endregion
9429
9548
  //#region src/client/widgets/world-card/WorldCard.tsx
@@ -9517,10 +9636,10 @@ window.__ModuleLoader__.load({
9517
9636
  }
9518
9637
  tag$11.textContent = css$11;
9519
9638
  var AvatarChoices_module_css_default = {
9520
- "summary": "rp_YCstOG_summary",
9521
- "text": "rp_YCstOG_text",
9639
+ "name": "rp_YCstOG_name",
9522
9640
  "option": "rp_YCstOG_option",
9523
- "name": "rp_YCstOG_name"
9641
+ "summary": "rp_YCstOG_summary",
9642
+ "text": "rp_YCstOG_text"
9524
9643
  };
9525
9644
  //#endregion
9526
9645
  //#region src/client/widgets/avatar-choices/AvatarChoices.tsx
@@ -9560,18 +9679,18 @@ window.__ModuleLoader__.load({
9560
9679
  }
9561
9680
  tag$10.textContent = css$10;
9562
9681
  var StartSessionDialog_module_css_default = {
9563
- "message": "rp_AnbLKG_message",
9564
- "advancedToggle": "rp_AnbLKG_advancedToggle",
9682
+ "advancedBody": "rp_AnbLKG_advancedBody",
9565
9683
  "option": "rp_AnbLKG_option",
9684
+ "optionText": "rp_AnbLKG_optionText",
9566
9685
  "optionSummary": "rp_AnbLKG_optionSummary",
9567
- "label": "rp_AnbLKG_label",
9686
+ "field": "rp_AnbLKG_field",
9568
9687
  "optionName": "rp_AnbLKG_optionName",
9569
- "advancedBody": "rp_AnbLKG_advancedBody",
9570
- "optionText": "rp_AnbLKG_optionText",
9571
- "form": "rp_AnbLKG_form",
9572
- "advanced": "rp_AnbLKG_advanced",
9688
+ "message": "rp_AnbLKG_message",
9573
9689
  "error": "rp_AnbLKG_error",
9574
- "field": "rp_AnbLKG_field"
9690
+ "advancedToggle": "rp_AnbLKG_advancedToggle",
9691
+ "label": "rp_AnbLKG_label",
9692
+ "form": "rp_AnbLKG_form",
9693
+ "advanced": "rp_AnbLKG_advanced"
9575
9694
  };
9576
9695
  //#endregion
9577
9696
  //#region src/client/pages/worlds/AddAvatarsDialog.tsx
@@ -10445,13 +10564,13 @@ window.__ModuleLoader__.load({
10445
10564
  tag$9.textContent = css$9;
10446
10565
  var SettingsFields_module_css_default = {
10447
10566
  "row": "rp_Rhi3yq_row",
10448
- "label": "rp_Rhi3yq_label",
10449
- "error": "rp_Rhi3yq_error",
10450
- "help": "rp_Rhi3yq_help",
10451
10567
  "field": "rp_Rhi3yq_field",
10452
- "area": "rp_Rhi3yq_area",
10568
+ "groupTitle": "rp_Rhi3yq_groupTitle",
10453
10569
  "group": "rp_Rhi3yq_group",
10454
- "groupTitle": "rp_Rhi3yq_groupTitle"
10570
+ "error": "rp_Rhi3yq_error",
10571
+ "label": "rp_Rhi3yq_label",
10572
+ "area": "rp_Rhi3yq_area",
10573
+ "help": "rp_Rhi3yq_help"
10455
10574
  };
10456
10575
  //#endregion
10457
10576
  //#region src/client/settings-form/SettingsFields.tsx
@@ -10650,6 +10769,18 @@ window.__ModuleLoader__.load({
10650
10769
  body: file
10651
10770
  }));
10652
10771
  }
10772
+ /** Sends a narration preset to a world, which has its authoring chat turn it into the world's prose prompts. */
10773
+ async function uploadPreset(worldId, file, language) {
10774
+ return await answer$1(await fetch(`${API_PREFIX}/worlds/import/preset?id=${encodeURIComponent(worldId)}&language=${encodeURIComponent(language)}`, {
10775
+ method: "POST",
10776
+ credentials: "same-origin",
10777
+ headers: {
10778
+ "x-file-name": encodeURIComponent(file.name),
10779
+ "content-type": "application/json"
10780
+ },
10781
+ body: file
10782
+ }));
10783
+ }
10653
10784
  async function startImport(id, choices, language) {
10654
10785
  return await answer$1(await fetch(`${API_PREFIX}/worlds/import/start?id=${encodeURIComponent(id)}`, {
10655
10786
  method: "POST",
@@ -10706,9 +10837,9 @@ window.__ModuleLoader__.load({
10706
10837
  }
10707
10838
  tag$8.textContent = css$8;
10708
10839
  var TranslateBanner_module_css_default = {
10709
- "error": "rp_Lx8vJa_error",
10840
+ "text": "rp_Lx8vJa_text",
10710
10841
  "banner": "rp_Lx8vJa_banner",
10711
- "text": "rp_Lx8vJa_text"
10842
+ "error": "rp_Lx8vJa_error"
10712
10843
  };
10713
10844
  //#endregion
10714
10845
  //#region src/client/pages/worlds/TranslateBanner.tsx
@@ -10793,6 +10924,8 @@ window.__ModuleLoader__.load({
10793
10924
  summary: avatar.summary
10794
10925
  }))];
10795
10926
  const selected = players.find((player) => player.value === choice)?.value ?? players[0]?.value;
10927
+ const chosenOpening = opening === "" ? void 0 : dialog.openings[Number(opening)];
10928
+ const openingValid = chosenOpening !== void 0 && (chosenOpening.character === void 0 || chosenOpening.character === selected);
10796
10929
  const base = {
10797
10930
  ...DEFAULT_SETTINGS,
10798
10931
  prompts: { language: t("language") }
@@ -10832,7 +10965,7 @@ window.__ModuleLoader__.load({
10832
10965
  name,
10833
10966
  ...selected.startsWith("avatar:") ? { playerAvatar: selected.slice(7) } : { playerCharacterId: selected },
10834
10967
  avatars: bringing.map((avatar) => avatar.key),
10835
- ...opening === "" ? {} : { opening: Number(opening) },
10968
+ ...!openingValid ? {} : { opening: Number(opening) },
10836
10969
  ...startTime.trim() === "" || shown["clock.mode"] === "real" ? {} : { startingTime: startTime.trim() },
10837
10970
  settings: fromDrafts(base, shown, options)
10838
10971
  });
@@ -10904,13 +11037,13 @@ window.__ModuleLoader__.load({
10904
11037
  }, player.value))
10905
11038
  ]
10906
11039
  }),
10907
- dialog.status === "ready" && dialog.openings.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11040
+ dialog.status === "ready" && dialog.openings.some((entry) => entry.character === void 0 || entry.character === selected) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10908
11041
  className: StartSessionDialog_module_css_default.field,
10909
11042
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10910
11043
  className: StartSessionDialog_module_css_default.label,
10911
11044
  children: t("startOpening")
10912
11045
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
10913
- value: opening,
11046
+ value: openingValid ? opening : "",
10914
11047
  disabled: dialog.submitting,
10915
11048
  onChange: (event) => {
10916
11049
  setOpening(event.target.value);
@@ -10918,10 +11051,10 @@ window.__ModuleLoader__.load({
10918
11051
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10919
11052
  value: "",
10920
11053
  children: t("startOpeningDefault")
10921
- }), dialog.openings.map((title, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11054
+ }), dialog.openings.flatMap((entry, index) => entry.character === void 0 || entry.character === selected ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10922
11055
  value: String(index),
10923
- children: title
10924
- }, index))]
11056
+ children: entry.title
11057
+ }, index)] : [])]
10925
11058
  })]
10926
11059
  }),
10927
11060
  dialog.status === "ready" && shown["clock.mode"] !== "real" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -11181,25 +11314,25 @@ window.__ModuleLoader__.load({
11181
11314
  }
11182
11315
  tag$7.textContent = css$7;
11183
11316
  var WorldsPage_module_css_default = {
11184
- "scrolls": "rp_FHUyRq_scrolls",
11185
- "toolbarActions": "rp_FHUyRq_toolbarActions",
11186
- "count": "rp_FHUyRq_count",
11187
- "spin": "rp_FHUyRq_spin",
11188
- "fits": "rp_FHUyRq_fits",
11189
- "authorButton": "rp_FHUyRq_authorButton",
11190
- "toolbar": "rp_FHUyRq_toolbar",
11317
+ "editTitle": "rp_FHUyRq_editTitle",
11191
11318
  "editHeader": "rp_FHUyRq_editHeader",
11319
+ "grid": "rp_FHUyRq_grid",
11192
11320
  "message": "rp_FHUyRq_message",
11193
- "cell": "rp_FHUyRq_cell",
11194
- "starters": "rp_FHUyRq_starters",
11195
- "editTitle": "rp_FHUyRq_editTitle",
11196
- "spinning": "rp_FHUyRq_spinning",
11197
- "page": "rp_FHUyRq_page",
11321
+ "toolbar": "rp_FHUyRq_toolbar",
11322
+ "spin": "rp_FHUyRq_spin",
11198
11323
  "notice": "rp_FHUyRq_notice",
11199
- "grid": "rp_FHUyRq_grid",
11324
+ "scrolls": "rp_FHUyRq_scrolls",
11325
+ "fits": "rp_FHUyRq_fits",
11326
+ "cell": "rp_FHUyRq_cell",
11200
11327
  "editBody": "rp_FHUyRq_editBody",
11328
+ "authorButton": "rp_FHUyRq_authorButton",
11201
11329
  "starter": "rp_FHUyRq_starter",
11202
- "viewport": "rp_FHUyRq_viewport"
11330
+ "viewport": "rp_FHUyRq_viewport",
11331
+ "toolbarActions": "rp_FHUyRq_toolbarActions",
11332
+ "spinning": "rp_FHUyRq_spinning",
11333
+ "starters": "rp_FHUyRq_starters",
11334
+ "count": "rp_FHUyRq_count",
11335
+ "page": "rp_FHUyRq_page"
11203
11336
  };
11204
11337
  //#endregion
11205
11338
  //#region src/client/pages/worlds/StarterWorlds.tsx
@@ -11269,34 +11402,34 @@ window.__ModuleLoader__.load({
11269
11402
  }
11270
11403
  tag$6.textContent = css$6;
11271
11404
  var ImportCardPage_module_css_default = {
11405
+ "noPicture": "rp_DmG_oG_noPicture",
11272
11406
  "picture": "rp_DmG_oG_picture",
11273
- "fieldHead": "rp_DmG_oG_fieldHead",
11274
- "entryHead": "rp_DmG_oG_entryHead",
11275
- "text": "rp_DmG_oG_text",
11276
- "page": "rp_DmG_oG_page",
11277
11407
  "space": "rp_DmG_oG_space",
11408
+ "error": "rp_DmG_oG_error",
11278
11409
  "entry": "rp_DmG_oG_entry",
11410
+ "body": "rp_DmG_oG_body",
11411
+ "entryHead": "rp_DmG_oG_entryHead",
11412
+ "title": "rp_DmG_oG_title",
11279
11413
  "fieldTitle": "rp_DmG_oG_fieldTitle",
11280
11414
  "entryTitle": "rp_DmG_oG_entryTitle",
11281
- "fieldMeta": "rp_DmG_oG_fieldMeta",
11282
- "tags": "rp_DmG_oG_tags",
11283
- "note": "rp_DmG_oG_note",
11284
- "noPicture": "rp_DmG_oG_noPicture",
11285
- "entryOff": "rp_DmG_oG_entryOff",
11286
- "error": "rp_DmG_oG_error",
11287
- "preview": "rp_DmG_oG_preview",
11288
- "choice": "rp_DmG_oG_choice",
11289
- "choiceText": "rp_DmG_oG_choiceText",
11290
- "body": "rp_DmG_oG_body",
11291
11415
  "top": "rp_DmG_oG_top",
11416
+ "choice": "rp_DmG_oG_choice",
11417
+ "field": "rp_DmG_oG_field",
11418
+ "row": "rp_DmG_oG_row",
11292
11419
  "header": "rp_DmG_oG_header",
11293
- "title": "rp_DmG_oG_title",
11294
- "section": "rp_DmG_oG_section",
11420
+ "note": "rp_DmG_oG_note",
11421
+ "fieldHead": "rp_DmG_oG_fieldHead",
11422
+ "choiceText": "rp_DmG_oG_choiceText",
11295
11423
  "about": "rp_DmG_oG_about",
11296
- "heading": "rp_DmG_oG_heading",
11297
11424
  "label": "rp_DmG_oG_label",
11298
- "row": "rp_DmG_oG_row",
11299
- "field": "rp_DmG_oG_field"
11425
+ "tags": "rp_DmG_oG_tags",
11426
+ "section": "rp_DmG_oG_section",
11427
+ "page": "rp_DmG_oG_page",
11428
+ "heading": "rp_DmG_oG_heading",
11429
+ "preview": "rp_DmG_oG_preview",
11430
+ "entryOff": "rp_DmG_oG_entryOff",
11431
+ "text": "rp_DmG_oG_text",
11432
+ "fieldMeta": "rp_DmG_oG_fieldMeta"
11300
11433
  };
11301
11434
  //#endregion
11302
11435
  //#region src/client/pages/worlds/ImportCardPage.tsx
@@ -11652,6 +11785,9 @@ window.__ModuleLoader__.load({
11652
11785
  const [uploading, setUploading] = (0, react.useState)(false);
11653
11786
  const [importNotice, setImportNotice] = (0, react.useState)();
11654
11787
  const picker = (0, react.useRef)(null);
11788
+ const presetPicker = (0, react.useRef)(null);
11789
+ const [presetBusy, setPresetBusy] = (0, react.useState)(false);
11790
+ const [presetNotice, setPresetNotice] = (0, react.useState)();
11655
11791
  const source = (0, react.useMemo)(() => editing === void 0 ? void 0 : worldSource(editing.id), [editing]);
11656
11792
  (0, react.useEffect)(() => {
11657
11793
  load();
@@ -11677,6 +11813,19 @@ window.__ModuleLoader__.load({
11677
11813
  setImportNotice(t("importUploadFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
11678
11814
  });
11679
11815
  };
11816
+ const choosePreset = (world, file) => {
11817
+ if (file === void 0) return;
11818
+ setPresetBusy(true);
11819
+ setPresetNotice(void 0);
11820
+ uploadPreset(world, file, t("language")).then((opened) => {
11821
+ setPresetBusy(false);
11822
+ if (!opened.started) setPresetNotice(t("presetNotStarted", { message: opened.failure ?? "" }));
11823
+ openChat(opened.chatSessionId);
11824
+ }, (failure) => {
11825
+ setPresetBusy(false);
11826
+ setPresetNotice(t("presetFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
11827
+ });
11828
+ };
11680
11829
  if (importing !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11681
11830
  className: WorldsPage_module_css_default.page,
11682
11831
  "data-testid": "roleplay-world-import",
@@ -11714,8 +11863,28 @@ window.__ModuleLoader__.load({
11714
11863
  className: WorldsPage_module_css_default.editTitle,
11715
11864
  children: editing.name
11716
11865
  }),
11866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11867
+ ref: presetPicker,
11868
+ type: "file",
11869
+ accept: ".json,application/json",
11870
+ hidden: true,
11871
+ "data-testid": "roleplay-preset-input",
11872
+ onChange: (event) => {
11873
+ choosePreset(editing.id, event.target.files?.[0]);
11874
+ event.target.value = "";
11875
+ }
11876
+ }),
11717
11877
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
11718
11878
  className: WorldsPage_module_css_default.authorButton,
11879
+ variant: "outline",
11880
+ size: "sm",
11881
+ disabled: presetBusy,
11882
+ onClick: () => {
11883
+ presetPicker.current?.click();
11884
+ },
11885
+ children: presetBusy ? t("presetOpening") : t("importPreset")
11886
+ }),
11887
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
11719
11888
  variant: "outline",
11720
11889
  size: "sm",
11721
11890
  onClick: () => {
@@ -11739,6 +11908,11 @@ window.__ModuleLoader__.load({
11739
11908
  role: "alert",
11740
11909
  children: t("authorWorldFailed", { message: state.authoring.error })
11741
11910
  }),
11911
+ presetNotice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11912
+ className: WorldsPage_module_css_default.notice,
11913
+ role: "alert",
11914
+ children: presetNotice
11915
+ }),
11742
11916
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslateBanner, {
11743
11917
  t,
11744
11918
  worldId: editing.id,
@@ -12309,6 +12483,10 @@ window.__ModuleLoader__.load({
12309
12483
  worldFolderHelp: "A new folder directly inside the roleplay worlds directory.",
12310
12484
  worldName: "World name",
12311
12485
  createWorldFailed: "Could not create the world: {message}",
12486
+ importPreset: "Import narration preset",
12487
+ presetOpening: "Opening…",
12488
+ presetFailed: "Could not import the preset: {message}",
12489
+ presetNotStarted: "The authoring chat opened but the preset was not applied: {message}. Ask it to apply the preset you uploaded.",
12312
12490
  authorWorld: "Author with AI",
12313
12491
  openingAuthor: "Opening…",
12314
12492
  authorWorldFailed: "Could not open the authoring chat: {message}",
@@ -12414,6 +12592,10 @@ window.__ModuleLoader__.load({
12414
12592
  worldFolderHelp: "将在角色扮演 worlds 目录下直接创建这个文件夹。",
12415
12593
  worldName: "世界名称",
12416
12594
  createWorldFailed: "无法创建世界:{message}",
12595
+ importPreset: "导入叙述预设",
12596
+ presetOpening: "正在打开…",
12597
+ presetFailed: "无法导入预设:{message}",
12598
+ presetNotStarted: "世界编辑对话已打开,但预设没有应用:{message}。可以请它应用你上传的预设。",
12417
12599
  authorWorld: "使用 AI 编辑",
12418
12600
  openingAuthor: "正在打开…",
12419
12601
  authorWorldFailed: "无法打开世界编辑对话:{message}",
@@ -12796,9 +12978,9 @@ window.__ModuleLoader__.load({
12796
12978
  tag$5.textContent = css$5;
12797
12979
  var BranchDialog_module_css_default = {
12798
12980
  "error": "rp_Dy1TaW_error",
12981
+ "field": "rp_Dy1TaW_field",
12799
12982
  "label": "rp_Dy1TaW_label",
12800
- "form": "rp_Dy1TaW_form",
12801
- "field": "rp_Dy1TaW_field"
12983
+ "form": "rp_Dy1TaW_form"
12802
12984
  };
12803
12985
  //#endregion
12804
12986
  //#region src/client/branch/BranchDialog.tsx
@@ -13267,17 +13449,17 @@ window.__ModuleLoader__.load({
13267
13449
  }
13268
13450
  tag$4.textContent = css$4;
13269
13451
  var SidebarPage_module_css_default = {
13270
- "text": "rp_Ptco8a_text",
13271
- "name": "rp_Ptco8a_name",
13272
13452
  "icon": "rp_Ptco8a_icon",
13273
- "page": "rp_Ptco8a_page",
13274
- "main": "rp_Ptco8a_main",
13275
13453
  "content": "rp_Ptco8a_content",
13454
+ "text": "rp_Ptco8a_text",
13276
13455
  "title": "rp_Ptco8a_title",
13277
- "bar": "rp_Ptco8a_bar",
13278
13456
  "description": "rp_Ptco8a_description",
13457
+ "bar": "rp_Ptco8a_bar",
13458
+ "main": "rp_Ptco8a_main",
13279
13459
  "entry": "rp_Ptco8a_entry",
13280
- "message": "rp_Ptco8a_message"
13460
+ "message": "rp_Ptco8a_message",
13461
+ "page": "rp_Ptco8a_page",
13462
+ "name": "rp_Ptco8a_name"
13281
13463
  };
13282
13464
  //#endregion
13283
13465
  //#region src/client/interface/SidebarPage.tsx
@@ -13603,26 +13785,26 @@ window.__ModuleLoader__.load({
13603
13785
  }
13604
13786
  tag$3.textContent = css$3;
13605
13787
  var ChatSettingsView_module_css_default = {
13606
- "pre": "rp_wLpbxW_pre",
13788
+ "run": "rp_wLpbxW_run",
13789
+ "table": "rp_wLpbxW_table",
13790
+ "error": "rp_wLpbxW_error",
13791
+ "row": "rp_wLpbxW_row",
13607
13792
  "title": "rp_wLpbxW_title",
13608
13793
  "field": "rp_wLpbxW_field",
13794
+ "saved": "rp_wLpbxW_saved",
13609
13795
  "link": "rp_wLpbxW_link",
13610
- "message": "rp_wLpbxW_message",
13611
- "table": "rp_wLpbxW_table",
13612
- "run": "rp_wLpbxW_run",
13796
+ "description": "rp_wLpbxW_description",
13797
+ "view": "rp_wLpbxW_view",
13798
+ "reasons": "rp_wLpbxW_reasons",
13613
13799
  "list": "rp_wLpbxW_list",
13614
13800
  "notice": "rp_wLpbxW_notice",
13615
- "label": "rp_wLpbxW_label",
13616
- "error": "rp_wLpbxW_error",
13617
13801
  "help": "rp_wLpbxW_help",
13802
+ "label": "rp_wLpbxW_label",
13618
13803
  "actions": "rp_wLpbxW_actions",
13619
- "saved": "rp_wLpbxW_saved",
13620
- "view": "rp_wLpbxW_view",
13621
- "row": "rp_wLpbxW_row",
13804
+ "pre": "rp_wLpbxW_pre",
13622
13805
  "activity": "rp_wLpbxW_activity",
13623
- "reasons": "rp_wLpbxW_reasons",
13624
13806
  "select": "rp_wLpbxW_select",
13625
- "description": "rp_wLpbxW_description"
13807
+ "message": "rp_wLpbxW_message"
13626
13808
  };
13627
13809
  //#endregion
13628
13810
  //#region src/client/chat-settings/settings-api.ts
@@ -13675,6 +13857,22 @@ window.__ModuleLoader__.load({
13675
13857
  throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
13676
13858
  }
13677
13859
  }
13860
+ /** Opens the session doctor chat of the story, made when it is first asked for. */
13861
+ async function openDoctor(id, title, language, signal) {
13862
+ const response = await fetch(`${API_PREFIX}/sessions/doctor?id=${encodeURIComponent(id)}`, {
13863
+ method: "POST",
13864
+ credentials: "same-origin",
13865
+ headers: { "content-type": "application/json" },
13866
+ body: JSON.stringify({
13867
+ title,
13868
+ language
13869
+ }),
13870
+ signal
13871
+ });
13872
+ const body = await response.json().catch(() => void 0);
13873
+ if (!response.ok || typeof body?.chatSessionId !== "string") throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
13874
+ return body.chatSessionId;
13875
+ }
13678
13876
  /** What a helper run was told and did; nothing when the run was not kept or has been dropped. */
13679
13877
  async function loadRun(id, run, signal) {
13680
13878
  const response = await fetch(`${API_PREFIX}/sessions/activity/run?id=${encodeURIComponent(id)}&run=${encodeURIComponent(run)}`, {
@@ -14175,7 +14373,7 @@ window.__ModuleLoader__.load({
14175
14373
  //#endregion
14176
14374
  //#region src/client/chat-settings/ChatSettingsView.tsx
14177
14375
  /** The settings of one chat. Ordinary DSH chats have ids of the same shape, so the host decides whether this one is a roleplay session. */
14178
- function ChatSettingsView({ t, sessionId }) {
14376
+ function ChatSettingsView({ t, sessionId, openChat }) {
14179
14377
  const session = roleplaySessionOf(sessionId);
14180
14378
  const [load, setLoad] = (0, react.useState)(session === void 0 ? { status: "not-roleplay" } : { status: "loading" });
14181
14379
  const [drafts, setDrafts] = (0, react.useState)({});
@@ -14248,6 +14446,13 @@ window.__ModuleLoader__.load({
14248
14446
  setError(t("reflectFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
14249
14447
  });
14250
14448
  };
14449
+ const askDoctor = () => {
14450
+ if (session === void 0) return;
14451
+ setError(void 0);
14452
+ openDoctor(session, t("doctorChat"), t("language"), new AbortController().signal).then(openChat, (failure) => {
14453
+ setError(t("doctorFailed", { message: failure instanceof Error ? failure.message : String(failure) }));
14454
+ });
14455
+ };
14251
14456
  const refreshActivity = () => {
14252
14457
  if (session === void 0) return;
14253
14458
  loadSettings(session, new AbortController().signal).then((next) => {
@@ -14370,6 +14575,23 @@ window.__ModuleLoader__.load({
14370
14575
  onStart: reflect,
14371
14576
  onRefresh: refreshActivity
14372
14577
  }),
14578
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
14579
+ className: ChatSettingsView_module_css_default.activity,
14580
+ "data-testid": "roleplay-doctor",
14581
+ children: [
14582
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("doctorTitle") }),
14583
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14584
+ className: ChatSettingsView_module_css_default.description,
14585
+ children: t("doctorHelp")
14586
+ }),
14587
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14588
+ variant: "ghost",
14589
+ size: "sm",
14590
+ onClick: askDoctor,
14591
+ children: t("doctorOpen")
14592
+ }) })
14593
+ ]
14594
+ }),
14373
14595
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VectorsSection, {
14374
14596
  t,
14375
14597
  status: payload.vectors,
@@ -14482,6 +14704,12 @@ window.__ModuleLoader__.load({
14482
14704
  reflectNothing: "No character had enough new to sort.",
14483
14705
  reflectRunning: "The characters are sorting what they took in…",
14484
14706
  reflectNow: "Reflect now",
14707
+ language: "en",
14708
+ doctorTitle: "Session doctor",
14709
+ doctorHelp: "A separate chat where an assistant reads this story's records, looks for what does not fit and proposes fixes. Each change is shown to you for approval before it is made.",
14710
+ doctorOpen: "Open the session doctor",
14711
+ doctorChat: "Session doctor",
14712
+ doctorFailed: "Could not open the session doctor: {message}",
14485
14713
  reflectHelp: "Each character with something new sorts it into what it believes: beliefs are merged, firmed up or let go, each resting on events it took in. It runs in the background; you can keep playing.",
14486
14714
  reflectFailed: "Could not start the reflection: {message}",
14487
14715
  reflectError: "The last pass failed: {message}",
@@ -14584,6 +14812,12 @@ window.__ModuleLoader__.load({
14584
14812
  reflectNothing: "没有角色积攒了足够多的新见闻。",
14585
14813
  reflectRunning: "角色们正在整理所见所闻……",
14586
14814
  reflectNow: "立即反思",
14815
+ language: "zh",
14816
+ doctorTitle: "会话医生",
14817
+ doctorHelp: "一个独立的对话:助手会阅读这个故事的记录,找出对不上的地方并提出修复。每一处修改在执行前都会交给你批准。",
14818
+ doctorOpen: "打开会话医生",
14819
+ doctorChat: "会话医生",
14820
+ doctorFailed: "无法打开会话医生:{message}",
14587
14821
  reflectHelp: "每个有新见闻的角色会把它们整理成自己的信念:合并、巩固或放下,每一条都要依据它接收到的事件。反思在后台进行,你可以继续游玩。",
14588
14822
  reflectFailed: "无法开始反思:{message}",
14589
14823
  reflectError: "上一次反思失败:{message}",
@@ -14637,7 +14871,8 @@ window.__ModuleLoader__.load({
14637
14871
  id: VIEW_ID,
14638
14872
  order: 20,
14639
14873
  label: () => t("tab"),
14640
- locale: NAMESPACE$2
14874
+ locale: NAMESPACE$2,
14875
+ inject: () => ({ openChat: createChatOpener(ctx) })
14641
14876
  }, ChatSettingsView));
14642
14877
  });
14643
14878
  }
@@ -14930,28 +15165,28 @@ window.__ModuleLoader__.load({
14930
15165
  }
14931
15166
  tag$2.textContent = css$2;
14932
15167
  var NarrationView_module_css_default = {
14933
- "sceneImage": "rp_NFPimG_sceneImage",
14934
- "output": "rp_NFPimG_output",
15168
+ "images": "rp_NFPimG_images",
15169
+ "imageError": "rp_NFPimG_imageError",
15170
+ "narration": "rp_NFPimG_narration",
15171
+ "playAll": "rp_NFPimG_playAll",
15172
+ "preview": "rp_NFPimG_preview",
14935
15173
  "speech": "rp_NFPimG_speech",
15174
+ "imageStatus": "rp_NFPimG_imageStatus",
15175
+ "oocLabel": "rp_NFPimG_oocLabel",
15176
+ "oocNote": "rp_NFPimG_oocNote",
14936
15177
  "imageButton": "rp_NFPimG_imageButton",
14937
- "diceList": "rp_NFPimG_diceList",
14938
- "diceSummary": "rp_NFPimG_diceSummary",
14939
- "dice": "rp_NFPimG_dice",
15178
+ "output": "rp_NFPimG_output",
14940
15179
  "oocRefused": "rp_NFPimG_oocRefused",
14941
- "note": "rp_NFPimG_note",
14942
- "preview": "rp_NFPimG_preview",
14943
- "narration": "rp_NFPimG_narration",
15180
+ "diceSummary": "rp_NFPimG_diceSummary",
15181
+ "line": "rp_NFPimG_line",
14944
15182
  "name": "rp_NFPimG_name",
14945
- "imageStatus": "rp_NFPimG_imageStatus",
14946
- "imageError": "rp_NFPimG_imageError",
14947
- "playAll": "rp_NFPimG_playAll",
14948
- "playLine": "rp_NFPimG_playLine",
15183
+ "dice": "rp_NFPimG_dice",
15184
+ "diceList": "rp_NFPimG_diceList",
14949
15185
  "words": "rp_NFPimG_words",
14950
- "line": "rp_NFPimG_line",
14951
- "oocNote": "rp_NFPimG_oocNote",
14952
- "images": "rp_NFPimG_images",
14953
15186
  "avatar": "rp_NFPimG_avatar",
14954
- "oocLabel": "rp_NFPimG_oocLabel"
15187
+ "sceneImage": "rp_NFPimG_sceneImage",
15188
+ "note": "rp_NFPimG_note",
15189
+ "playLine": "rp_NFPimG_playLine"
14955
15190
  };
14956
15191
  //#endregion
14957
15192
  //#region src/client/transcript/PreviewNode.tsx
@@ -15216,11 +15451,11 @@ window.__ModuleLoader__.load({
15216
15451
  }
15217
15452
  tag$1.textContent = css$1;
15218
15453
  var SuggestionsDock_module_css_default = {
15219
- "label": "rp_rWH4DG_label",
15220
- "dock": "rp_rWH4DG_dock",
15221
- "chip": "rp_rWH4DG_chip",
15222
15454
  "card": "rp_rWH4DG_card",
15223
- "lines": "rp_rWH4DG_lines"
15455
+ "dock": "rp_rWH4DG_dock",
15456
+ "label": "rp_rWH4DG_label",
15457
+ "lines": "rp_rWH4DG_lines",
15458
+ "chip": "rp_rWH4DG_chip"
15224
15459
  };
15225
15460
  //#endregion
15226
15461
  //#region src/client/transcript/SuggestionsDock.tsx
@@ -15244,10 +15479,12 @@ window.__ModuleLoader__.load({
15244
15479
  const [offered, setOffered] = (0, react.useState)([]);
15245
15480
  const [meanwhile, setMeanwhile] = (0, react.useState)([]);
15246
15481
  const [unfinished, setUnfinished] = (0, react.useState)([]);
15482
+ const [unwritten, setUnwritten] = (0, react.useState)(0);
15247
15483
  (0, react.useEffect)(() => {
15248
15484
  setOffered([]);
15249
15485
  setMeanwhile([]);
15250
15486
  setUnfinished([]);
15487
+ setUnwritten(0);
15251
15488
  if (latest === void 0) return void 0;
15252
15489
  let stopped = false;
15253
15490
  let timer;
@@ -15258,9 +15495,11 @@ window.__ModuleLoader__.load({
15258
15495
  setMeanwhile((previous) => previous.join("\n") === away.join("\n") ? previous : away);
15259
15496
  const world = found.find((note) => note.kind === "world")?.lines ?? [];
15260
15497
  setUnfinished((previous) => previous.join("\n") === world.join("\n") ? previous : world);
15498
+ const waiting = found.find((note) => note.kind === "unwritten")?.count ?? 0;
15499
+ setUnwritten(waiting);
15261
15500
  const lines = found.find((note) => note.kind === "suggestions")?.lines;
15262
15501
  if (lines !== void 0 && lines.length > 0) setOffered(lines);
15263
- else if (attempt < GIVE_UP_AFTER) timer = setTimeout(() => {
15502
+ if ((lines === void 0 || lines.length === 0 || waiting > 0) && attempt < GIVE_UP_AFTER) timer = setTimeout(() => {
15264
15503
  look(attempt + 1);
15265
15504
  }, POLL_MS);
15266
15505
  }).catch((error) => {
@@ -15273,12 +15512,17 @@ window.__ModuleLoader__.load({
15273
15512
  if (timer !== void 0) clearTimeout(timer);
15274
15513
  };
15275
15514
  }, [latest, notes]);
15276
- if (running || offered.length === 0 && meanwhile.length === 0 && unfinished.length === 0) return null;
15515
+ if (running || offered.length === 0 && meanwhile.length === 0 && unfinished.length === 0 && unwritten === 0) return null;
15277
15516
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15278
15517
  className: SuggestionsDock_module_css_default.dock,
15279
15518
  "data-testid": "roleplay-suggestions",
15280
15519
  "data-rp": "suggestions",
15281
15520
  children: [
15521
+ unwritten > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
15522
+ className: SuggestionsDock_module_css_default.label,
15523
+ "data-testid": "roleplay-unwritten",
15524
+ children: t("unwritten", { count: unwritten })
15525
+ }),
15282
15526
  unfinished.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15283
15527
  className: SuggestionsDock_module_css_default.card,
15284
15528
  "data-testid": "roleplay-world-findings",
@@ -15332,10 +15576,10 @@ window.__ModuleLoader__.load({
15332
15576
  tag.textContent = css;
15333
15577
  var TurnsDock_module_css_default = {
15334
15578
  "button": "rp_f4YLlq_button",
15335
- "count": "rp_f4YLlq_count",
15336
15579
  "select": "rp_f4YLlq_select",
15337
- "error": "rp_f4YLlq_error",
15338
15580
  "group": "rp_f4YLlq_group",
15581
+ "count": "rp_f4YLlq_count",
15582
+ "error": "rp_f4YLlq_error",
15339
15583
  "dock": "rp_f4YLlq_dock"
15340
15584
  };
15341
15585
  //#endregion
@@ -15525,6 +15769,7 @@ window.__ModuleLoader__.load({
15525
15769
  //#region src/client/transcript/locales.ts
15526
15770
  const dictionaries = {
15527
15771
  en: {
15772
+ unwritten: "{count} round(s) not yet written into the story's memory",
15528
15773
  speakAll: "Play narration",
15529
15774
  speakLine: "Play this line",
15530
15775
  speaking: "Generating speech…",
@@ -15564,6 +15809,7 @@ window.__ModuleLoader__.load({
15564
15809
  dicePlayer: "You rolled:"
15565
15810
  },
15566
15811
  zh: {
15812
+ unwritten: "有 {count} 个回合尚未写入故事记忆",
15567
15813
  speakAll: "播放整段",
15568
15814
  speakLine: "播放这句台词",
15569
15815
  speaking: "正在生成语音…",