@dsh-agentic-roleplay/core 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/lib/{notes-CJzbN_-E.js → activity-BbqFG9-3.js} +35 -9
  2. package/lib/authoring.js +3 -3
  3. package/lib/client.js +880 -372
  4. package/lib/client.js.map +1 -1
  5. package/lib/compaction.js +1 -1
  6. package/lib/{documents-BBq88wXP.js → documents-ZVoUTnD2.js} +54 -33
  7. package/lib/{gallery-CjG9_4Sz.js → gallery-KGCdeCnM.js} +2 -2
  8. package/lib/{generator-pxZS-pu-.js → generator-NYnNdpWb.js} +100 -9
  9. package/lib/images.js +3 -3
  10. package/lib/index.js +220 -15
  11. package/lib/{narration-tYy6Rkfr.js → narration-DcnCqA1l.js} +20 -3
  12. package/lib/orchestration.js +510 -82
  13. package/lib/{presenter-agent-DbZALurg.js → presenter-agent-7j1c7QEz.js} +3 -3
  14. package/lib/{worlds-Bj-EGS_i.js → worlds-DYgjdH8O.js} +28 -2
  15. package/package.json +3 -2
  16. package/prompts/en/roleplay/faction-strategist.md +5 -0
  17. package/prompts/en/roleplay/trigger-judge.md +3 -0
  18. package/prompts/zh/roleplay/faction-strategist.md +5 -0
  19. package/prompts/zh/roleplay/trigger-judge.md +3 -0
  20. package/starter-worlds/blackwater-observatory/characters/arthur-moore/character.json +65 -0
  21. package/starter-worlds/blackwater-observatory/characters/clara-whitlock/character.json +87 -0
  22. package/starter-worlds/blackwater-observatory/characters/eleanor-graves/character.json +80 -0
  23. package/starter-worlds/blackwater-observatory/characters/marcus-reed/character.json +73 -0
  24. package/starter-worlds/blackwater-observatory/items/anonymous-letter/item.json +9 -0
  25. package/starter-worlds/blackwater-observatory/items/brass-laboratory-key/item.json +10 -0
  26. package/starter-worlds/blackwater-observatory/items/claras-gossip-notebook/item.json +9 -0
  27. package/starter-worlds/blackwater-observatory/items/harlans-notebook/item.json +10 -0
  28. package/starter-worlds/blackwater-observatory/items/investigators-coat/item.json +10 -0
  29. package/starter-worlds/blackwater-observatory/items/investigators-notebook/item.json +9 -0
  30. package/starter-worlds/blackwater-observatory/items/locked-filing-cabinet/item.json +10 -0
  31. package/starter-worlds/blackwater-observatory/items/marcus-calibration-notes/item.json +9 -0
  32. package/starter-worlds/blackwater-observatory/items/mayors-administrative-seal/item.json +9 -0
  33. package/starter-worlds/blackwater-observatory/items/municipal-lockbox/item.json +10 -0
  34. package/starter-worlds/blackwater-observatory/items/pocket-revolver/item.json +10 -0
  35. package/starter-worlds/blackwater-observatory/items/room-7-cash-receipt/item.json +9 -0
  36. package/starter-worlds/blackwater-observatory/items/rusting-mine-cart/item.json +10 -0
  37. package/starter-worlds/blackwater-observatory/items/signal-recording-strip/item.json +9 -0
  38. package/starter-worlds/blackwater-observatory/items/silver-pocket-watch/item.json +9 -0
  39. package/starter-worlds/blackwater-observatory/items/survey-archive-cabinet/item.json +10 -0
  40. package/starter-worlds/blackwater-observatory/items/surveyors-map/item.json +10 -0
  41. package/starter-worlds/blackwater-observatory/items/unknown-visitors-note-fragment/item.json +10 -0
  42. package/starter-worlds/blackwater-observatory/locations/blackwater-ridge/location.json +5 -0
  43. package/starter-worlds/blackwater-observatory/locations/iron-stag-bar/location.json +30 -0
  44. package/starter-worlds/blackwater-observatory/locations/iron-stag-room-7/location.json +18 -0
  45. package/starter-worlds/blackwater-observatory/locations/north-forest-cabin/location.json +18 -0
  46. package/starter-worlds/blackwater-observatory/locations/observatory-directors-office/location.json +20 -0
  47. package/starter-worlds/blackwater-observatory/locations/observatory-telescope-chamber/location.json +25 -0
  48. package/starter-worlds/blackwater-observatory/locations/old-mine-entrance/location.json +27 -0
  49. package/starter-worlds/blackwater-observatory/locations/old-mine-main-tunnel/location.json +13 -0
  50. package/starter-worlds/blackwater-observatory/locations/town-hall-mayors-office/location.json +25 -0
  51. package/starter-worlds/blackwater-observatory/locations/town-hall-records-room/location.json +13 -0
  52. package/starter-worlds/blackwater-observatory/locations/town-square/location.json +30 -0
  53. package/starter-worlds/blackwater-observatory/triggers.json +20 -0
  54. package/starter-worlds/blackwater-observatory/variables.json +39 -0
  55. package/starter-worlds/blackwater-observatory/world.json +27 -0
@@ -1,6 +1,6 @@
1
1
  import { n as roleplaySessionOf } from "./chat-AKrVcWIC.js";
2
- import { p as inheritPrompts, w as SessionNotFoundError } from "./worlds-Bj-EGS_i.js";
3
- import { l as inheritImages } from "./generator-pxZS-pu-.js";
2
+ import { p as inheritPrompts, w as SessionNotFoundError } from "./worlds-DYgjdH8O.js";
3
+ import { u as inheritImages } from "./generator-NYnNdpWb.js";
4
4
  import { join } from "node:path";
5
5
  import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
6
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
@@ -595,6 +595,10 @@ const declinesToAuthor = {
595
595
  notes: ""
596
596
  })
597
597
  };
598
+ /** Lets no organisation act: without a strategist factions change only through what the story records. */
599
+ const factionsStayPut = { strategize: () => Promise.resolve({ acted: [] }) };
600
+ /** Judges nothing: without a judge a trigger that waits on a statement never sees it hold. */
601
+ const judgesNothing = { judge: () => Promise.resolve({ judged: 0 }) };
598
602
  /** Offers nothing: without a suggester the player writes their own move. */
599
603
  const offersNothing = { suggest: () => Promise.resolve([]) };
600
604
  function defaultBoundaries() {
@@ -608,6 +612,8 @@ function defaultBoundaries() {
608
612
  narrationChecker: exactUtterances,
609
613
  committer: writesNothing,
610
614
  author: declinesToAuthor,
615
+ strategist: factionsStayPut,
616
+ judge: judgesNothing,
611
617
  suggester: offersNothing,
612
618
  recaller: recordsRecall,
613
619
  sceneContext: castSummary
@@ -1119,10 +1125,14 @@ function updatePlotProgress(store, plotId, developmentId, action) {
1119
1125
  }
1120
1126
  //#endregion
1121
1127
  //#region src/shared/notes.ts
1122
- const NOTE_KINDS = ["suggestions", "away"];
1128
+ const NOTE_KINDS = [
1129
+ "suggestions",
1130
+ "away",
1131
+ "world"
1132
+ ];
1123
1133
  //#endregion
1124
1134
  //#region src/host/sessions/notes.ts
1125
- const KEY = "notes";
1135
+ const KEY$1 = "notes";
1126
1136
  const isNote = (value) => {
1127
1137
  if (typeof value !== "object" || value === null) return false;
1128
1138
  const note = value;
@@ -1130,12 +1140,12 @@ const isNote = (value) => {
1130
1140
  };
1131
1141
  /** The notes of a session, at most one per kind. */
1132
1142
  function readNotes(session) {
1133
- const stored = session.metadata.getValue(KEY);
1143
+ const stored = session.metadata.getValue(KEY$1);
1134
1144
  return Array.isArray(stored) ? stored.filter(isNote) : [];
1135
1145
  }
1136
1146
  /** Replaces the note of the same kind. */
1137
1147
  function putNote(session, note) {
1138
- session.metadata.setValue(KEY, [...readNotes(session).filter((existing) => existing.kind !== note.kind), note]);
1148
+ session.metadata.setValue(KEY$1, [...readNotes(session).filter((existing) => existing.kind !== note.kind), note]);
1139
1149
  }
1140
1150
  /** The most lines one note keeps: what is past it is not told. */
1141
1151
  const MAX_NOTE_LINES = 8;
@@ -1150,7 +1160,7 @@ function addToNote(session, kind, turn, lines) {
1150
1160
  }
1151
1161
  /** Removes every note: they belong to the turn that made them. */
1152
1162
  function clearNotes(session) {
1153
- if (readNotes(session).length > 0) session.metadata.setValue(KEY, []);
1163
+ if (readNotes(session).length > 0) session.metadata.setValue(KEY$1, []);
1154
1164
  }
1155
1165
  /**
1156
1166
  * The notes of a session, for the player's screen.
@@ -1161,6 +1171,22 @@ function notesOfSession(deps, id) {
1161
1171
  return readNotes(deps.open(id));
1162
1172
  }
1163
1173
  //#endregion
1164
- export { readTime as C, endRound as S, zoneOf as T, sameWords as _, readNotes as a, describeTime as b, describePacingAdvice as c, plotProgressOf as d, populatePlots as f, defaultBoundaries as g, Timelines as h, putNote as i, pacingAdvice as l, TimelineError as m, clearNotes as n, PLOTS_METADATA_KEY as o, updatePlotProgress as p, notesOfSession as r, addSessionPlot as s, addToNote as t, plotAuthorNeeded as u, ClockError as v, skipTime as w, describeWhen as x, beginTurn as y };
1174
+ //#region src/host/sessions/activity.ts
1175
+ const KEY = "activity";
1176
+ const isEntry = (value) => {
1177
+ if (typeof value !== "object" || value === null) return false;
1178
+ const entry = value;
1179
+ return typeof entry["at"] === "number" && typeof entry["label"] === "string" && typeof entry["model"] === "string" && typeof entry["ms"] === "number" && typeof entry["calls"] === "number" && (entry["error"] === void 0 || typeof entry["error"] === "string");
1180
+ };
1181
+ /** The recorded runs, oldest first. */
1182
+ function readActivity(session) {
1183
+ const stored = session.metadata.getValue(KEY);
1184
+ return Array.isArray(stored) ? stored.filter(isEntry) : [];
1185
+ }
1186
+ function recordActivity(session, entry) {
1187
+ session.metadata.setValue(KEY, [...readActivity(session), entry].slice(-60));
1188
+ }
1189
+ //#endregion
1190
+ export { describeWhen as C, zoneOf as D, skipTime as E, describeTime as S, readTime as T, Timelines as _, notesOfSession as a, ClockError as b, PLOTS_METADATA_KEY as c, pacingAdvice as d, plotAuthorNeeded as f, TimelineError as g, updatePlotProgress as h, clearNotes as i, addSessionPlot as l, populatePlots as m, recordActivity as n, putNote as o, plotProgressOf as p, addToNote as r, readNotes as s, readActivity as t, describePacingAdvice as u, defaultBoundaries as v, endRound as w, beginTurn as x, sameWords as y };
1165
1191
 
1166
- //# sourceMappingURL=notes-CJzbN_-E.js.map
1192
+ //# sourceMappingURL=activity-BbqFG9-3.js.map
package/lib/authoring.js CHANGED
@@ -1,6 +1,6 @@
1
- import { C as finish, D as survey, G as PROSE_PROMPTS, J as readWorldPrompt, K as deleteWorldPrompt, S as endReview, T as isReviewing, Y as writeWorldPrompt, a as replaceAuthoredEntity, ct as InvalidEditProblems, d as editWorldPlots, f as editWorldRelation, g as readWorldEditor, gt as parseImportCommand, i as readAuthoredEntityDocument, n as createAuthoredEntity, pt as parseRelationEdit, q as listWorldPrompts, r as deleteAuthoredEntity, t as AUTHORED_ENTITY_KINDS, tt as IMPORT_FOLDER, w as importPhase, x as build, y as authoredWorldOf } from "./documents-BBq88wXP.js";
2
- import { i as parsePlotsFile, l as formatIssue, v as shippedPromptsDirectory } from "./worlds-Bj-EGS_i.js";
3
- import { D as runChild } from "./generator-pxZS-pu-.js";
1
+ import { C as endReview, E as isReviewing, J as listWorldPrompts, K as PROSE_PROMPTS, O as survey, S as build, T as importPhase, X as writeWorldPrompt, Y as readWorldPrompt, _t as parseImportCommand, a as replaceAuthoredEntity, b as authoredWorldOf, d as editWorldPlots, f as editWorldRelation, g as readWorldEditor, i as readAuthoredEntityDocument, lt as InvalidEditProblems, mt as parseRelationEdit, n as createAuthoredEntity, nt as IMPORT_FOLDER, q as deleteWorldPrompt, r as deleteAuthoredEntity, t as AUTHORED_ENTITY_KINDS, w as finish } from "./documents-ZVoUTnD2.js";
2
+ import { i as parsePlotsFile, l as formatIssue, v as shippedPromptsDirectory } from "./worlds-DYgjdH8O.js";
3
+ import { A as runChild } from "./generator-NYnNdpWb.js";
4
4
  import { join } from "node:path";
5
5
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
6
6
  import { defineTool } from "@deepseek-ai/dsh-tools";