@dsh-agentic-roleplay/core 0.12.6 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/lib/{authoring-tools-BpkpGMSO.js → authoring-tools-CKV1UnN7.js} +1133 -139
  2. package/lib/authoring.js +340 -54
  3. package/lib/client.js +1675 -729
  4. package/lib/client.js.map +1 -1
  5. package/lib/compaction.js +2 -2
  6. package/lib/doctor.js +2 -2
  7. package/lib/{library-CnWOHwQl.js → gallery-CT5uj50b.js} +212 -7
  8. package/lib/{hooks-P_--KSFl.js → hooks-CnxV2uEh.js} +46 -17
  9. package/lib/images.js +3 -4
  10. package/lib/index.js +409 -26
  11. package/lib/{presenter-agent-BTpJxmGi.js → interpreter-Cz5qsuXk.js} +155 -64
  12. package/lib/{lorebook-author-tools-CWZ6WRN-.js → lorebook-author-tools-p3Nfpuxh.js} +6 -6
  13. package/lib/lorebook-authoring.js +5 -5
  14. package/lib/{narration-DAHmte8p.js → narration-CUZIXzab.js} +8 -2
  15. package/lib/orchestration.js +64 -19
  16. package/lib/{pack-jail-DSTyLhMc.js → pack-jail-KyZen_gy.js} +19 -13
  17. package/lib/{packs-D9_N8kDF.js → packs-DU171pDX.js} +2 -2
  18. package/lib/presenter-agent-CwDg0WE8.js +59 -0
  19. package/lib/{preset-B69AXtip.js → preset-BO8iWQ-n.js} +3 -3
  20. package/lib/{preset-author-tools-BJtt7D0J.js → preset-author-tools-C83shASm.js} +6 -6
  21. package/lib/preset-authoring.js +5 -5
  22. package/lib/{reflection-2uzE3U-v.js → reflection-CXS87Di3.js} +8 -7
  23. package/lib/{serial-DnVqMDe5.js → serial-xcAG57p_.js} +199 -43
  24. package/lib/{text-B-HsLdb-.js → text-KnqhN_Zv.js} +4 -1
  25. package/lib/{turn-guard-D4YHE00t.js → turn-guard-CfsGepCg.js} +2 -2
  26. package/package.json +3 -2
  27. package/prompts/en/import/finish-ok.md +2 -0
  28. package/prompts/en/import/next-stage-go.md +1 -0
  29. package/prompts/en/import/next-stage-paused.md +1 -0
  30. package/prompts/en/import/next-survey-paused.md +1 -0
  31. package/prompts/en/import/notice-staged.md +5 -0
  32. package/prompts/en/import/pause-stages.md +1 -0
  33. package/prompts/en/import/pause-survey.md +1 -0
  34. package/prompts/en/roleplay/image-worth.md +5 -0
  35. package/prompts/en/world/procedure.md +3 -0
  36. package/prompts/zh/import/finish-ok.md +2 -0
  37. package/prompts/zh/import/next-stage-go.md +1 -0
  38. package/prompts/zh/import/next-stage-paused.md +1 -0
  39. package/prompts/zh/import/next-survey-paused.md +1 -0
  40. package/prompts/zh/import/notice-staged.md +5 -0
  41. package/prompts/zh/import/pause-stages.md +1 -0
  42. package/prompts/zh/import/pause-survey.md +1 -0
  43. package/prompts/zh/roleplay/image-worth.md +5 -0
  44. package/prompts/zh/world/procedure.md +3 -0
  45. package/lib/gallery-D0h0X7Jy.js +0 -190
  46. package/lib/generator-CAJkevKl.js +0 -150
@@ -0,0 +1,59 @@
1
+ import { t as promptFor } from "./access-5vtPAT3O.js";
2
+ import { l as runChild } from "./child-Bfj7-Iuo.js";
3
+ import { r as imageTools, t as canReadImages } from "./interpreter-Cz5qsuXk.js";
4
+ // src/host/images/presenter-agent.ts
5
+ const RESULT = {
6
+ type: "object",
7
+ properties: { summary: {
8
+ type: "string",
9
+ description: "A brief factual description of the images the tools generated."
10
+ } },
11
+ required: ["summary"],
12
+ additionalProperties: false
13
+ };
14
+ /**
15
+ * One-shot image presentation agent, with its tools on its own scope. Asked for a picture of a moment, it either shows an image the session
16
+ * already has (when `reuse` is on and the picture is not asked for outright) or has a new one generated.
17
+ */
18
+ async function runImagePresenter(job) {
19
+ const generated = [];
20
+ const sees = job.reuse === true && job.attachments !== void 0 && await canReadImages(job.parent, "", job.signal);
21
+ return {
22
+ summary: (await runChild({
23
+ parent: job.parent,
24
+ signal: job.signal,
25
+ ...job.reasoningEffort === void 0 ? {} : { reasoningEffort: job.reasoningEffort },
26
+ ...job.sampling === void 0 ? {} : { sampling: job.sampling },
27
+ persona: promptFor(job.parent, "roleplay/image-presenter", job.language, { reuse: job.reuse === true ? promptFor(job.parent, "roleplay/image-reuse", job.language) : "" }),
28
+ prompt: [
29
+ job.reuse === true ? "Find or create the picture for this moment of the story." : `Create ${job.purpose === "reference" ? "a canonical reference image" : "a transient story illustration"} as requested.`,
30
+ `Request: ${job.request}`,
31
+ `This is turn ${job.turn}, timeline node ${job.timelineNode}.`
32
+ ].join("\n"),
33
+ tools: imageTools({
34
+ root: job.root,
35
+ story: job.story,
36
+ service: job.service,
37
+ turn: job.turn,
38
+ timelineNode: job.timelineNode,
39
+ generated,
40
+ signal: job.signal,
41
+ ...job.reuse === true ? {
42
+ library: true,
43
+ sees,
44
+ ...job.attachments === void 0 ? {} : { attachments: job.attachments },
45
+ ...job.embedder === void 0 ? {} : { embedder: job.embedder }
46
+ } : {},
47
+ ...job.referenceMode === void 0 ? {} : { referenceMode: job.referenceMode }
48
+ }),
49
+ result: RESULT,
50
+ beforeSubmit: () => generated.length === 0 ? "you have not shown or generated an image: use the appropriate tool before finishing" : void 0,
51
+ ...job.trace === void 0 ? {} : { trace: job.trace },
52
+ maxCalls: 16
53
+ })).summary,
54
+ images: [...generated]
55
+ };
56
+ }
57
+ export { runImagePresenter as t };
58
+
59
+ //# sourceMappingURL=presenter-agent-CwDg0WE8.js.map
@@ -1,6 +1,6 @@
1
- import { Wt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BpkpGMSO.js";
1
+ import { Gt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-CKV1UnN7.js";
2
2
  import { p as SAMPLING_RANGES } from "./child-Bfj7-Iuo.js";
3
- import { St as cleanText } from "./serial-DnVqMDe5.js";
3
+ import { jt as cleanText } from "./serial-xcAG57p_.js";
4
4
  // src/host/import/preset.ts
5
5
  /** The older preset layout keeps its texts under fixed keys. */
6
6
  const LEGACY_KEYS = [
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
239
239
  }
240
240
  export { readPreset as n, selectPrompts as r, previewPreset as t };
241
241
 
242
- //# sourceMappingURL=preset-B69AXtip.js.map
242
+ //# sourceMappingURL=preset-BO8iWQ-n.js.map
@@ -1,9 +1,9 @@
1
1
  import "./access-5vtPAT3O.js";
2
- import { Et as IMPORT_FOLDER, H as PRESET_FILE, Tt as withPlayer, X as readPreset, Y as presetDirectory, at as writeWorldPrompt, et as updatePresetInfo, it as readWorldPrompt, l as extractStyleFrom, nt as deleteWorldPrompt, rt as listWorldPrompts, tt as PROSE_PROMPTS } from "./serial-DnVqMDe5.js";
3
- import { n as readPreset$1 } from "./preset-B69AXtip.js";
4
- import { o as contextOf } from "./authoring-tools-BpkpGMSO.js";
5
- import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
6
- import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-P_--KSFl.js";
2
+ import { Ft as IMPORT_FOLDER, Pt as withPlayer, Z as PRESET_FILE, at as readPreset, dt as deleteWorldPrompt, f as extractStyleFrom, ft as listWorldPrompts, it as presetDirectory, lt as updatePresetInfo, mt as writeWorldPrompt, pt as readWorldPrompt, ut as PROSE_PROMPTS } from "./serial-xcAG57p_.js";
3
+ import { n as readPreset$1 } from "./preset-BO8iWQ-n.js";
4
+ import { o as contextOf } from "./authoring-tools-CKV1UnN7.js";
5
+ import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
6
+ import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-CnxV2uEh.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync } from "node:fs";
9
9
  import { readFile, rm } from "node:fs/promises";
@@ -279,4 +279,4 @@ async function presetApproval(exec, next, carries, auto = () => false) {
279
279
  }
280
280
  export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
281
281
 
282
- //# sourceMappingURL=preset-author-tools-BJtt7D0J.js.map
282
+ //# sourceMappingURL=preset-author-tools-C83shASm.js.map
@@ -1,9 +1,9 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-BpkpGMSO.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-D4YHE00t.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-CKV1UnN7.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-CfsGepCg.js";
3
3
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
4
- import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BJtt7D0J.js";
5
- import "./hooks-P_--KSFl.js";
6
- import { Y as presetDirectory } from "./serial-DnVqMDe5.js";
4
+ import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-C83shASm.js";
5
+ import "./hooks-CnxV2uEh.js";
6
+ import { it as presetDirectory } from "./serial-xcAG57p_.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync } from "node:fs";
9
9
  // src/preset-authoring.ts
@@ -1,10 +1,11 @@
1
1
  import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-Bfj7-Iuo.js";
2
- import { $ as sha, A as routeVerdicts, D as mergeReports, E as askYesNo, J as loadPreset, T as announceProblem, j as yesAt, k as noAt, q as listPresets, t as SerialQueue } from "./serial-DnVqMDe5.js";
2
+ import { B as yesAt, F as askYesNo, I as mergeReports, P as announceProblem, R as noAt, ct as sha, nt as listPresets, rt as loadPreset, t as SerialQueue, z as routeVerdicts } from "./serial-xcAG57p_.js";
3
+ import { i as wordsOf } from "./narration-CUZIXzab.js";
3
4
  import { t as promptFor } from "./access-5vtPAT3O.js";
4
- import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-P_--KSFl.js";
5
- import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
6
- import { s as inheritImages } from "./library-CnWOHwQl.js";
7
- import { i as inheritPacks } from "./packs-D9_N8kDF.js";
5
+ import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-CnxV2uEh.js";
6
+ import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
7
+ import { d as inheritImages } from "./gallery-CT5uj50b.js";
8
+ import { i as inheritPacks } from "./packs-DU171pDX.js";
8
9
  import { dirname, join } from "node:path";
9
10
  import { characterKey, locationKey, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
10
11
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -69,7 +70,7 @@ function viewOf(timeline) {
69
70
  }
70
71
  /** Where a notice stands for a turn that is not told by its own events: the player's words and what was delivered, as plain text. */
71
72
  function noticeText(node) {
72
- const told = node.output === void 0 ? "(nothing was delivered)" : node.output.segments.map((segment) => segment.type === "utterance" ? `${segment.name}: "${segment.text}"` : segment.text).join("\n");
73
+ const told = node.output === void 0 ? "(nothing was delivered)" : wordsOf(node.output.segments, (segment) => `${segment.name}: "${segment.text}"`).join("\n");
73
74
  const ooc = node.output?.ooc;
74
75
  const ruling = ooc === void 0 ? "" : ooc.question === true ? `\nThe question was answered out of character: ${ooc.note}` : `\nThe command was ruled ${ooc.legal ? "legal" : "illegal and refused"}: ${ooc.note}`;
75
76
  return `The story, as it went earlier (restored):\nThe player said: ${node.player}${ruling}\nIt was told to the player:\n${told}`;
@@ -1504,4 +1505,4 @@ function memoryReflector(deps) {
1504
1505
  }
1505
1506
  export { pathTo as _, whereabouts as a, BranchError as c, recordPreset as d, switchPreset as f, childrenOf as g, START_SNAPSHOT as h, reflectionStatus as i, copyPreset as l, writeTimeline as m, memoryReflector as n, TimelineError as o, readTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, presetStatus as u, snapshotOf as v };
1506
1507
 
1507
- //# sourceMappingURL=reflection-2uzE3U-v.js.map
1508
+ //# sourceMappingURL=reflection-CXS87Di3.js.map
@@ -1,9 +1,9 @@
1
1
  import { m as parseSampling } from "./child-Bfj7-Iuo.js";
2
- import { f as parseSwitchboard } from "./narration-DAHmte8p.js";
2
+ import { p as parseSwitchboard } from "./narration-CUZIXzab.js";
3
3
  import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-5vtPAT3O.js";
4
- import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-P_--KSFl.js";
5
- import { i as translator, r as languageOf$1 } from "./text-B-HsLdb-.js";
6
- import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CnWOHwQl.js";
4
+ import { G as readDocument, J as formatIssue, K as errorMessage, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as Reader, rt as promptProblem, tt as languageOf } from "./hooks-CnxV2uEh.js";
5
+ import { i as translator, r as languageOf$1 } from "./text-KnqhN_Zv.js";
6
+ import { C as mapLimit, D as uniqueKey, E as trOf, T as slug, w as norm } from "./gallery-CT5uj50b.js";
7
7
  import { dirname, join } from "node:path";
8
8
  import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, isTimeZone, parseInstant, valueIssue } from "@dsh-agentic-roleplay/state";
9
9
  import { existsSync, readFileSync, readdirSync } from "node:fs";
@@ -1352,6 +1352,13 @@ function findPanel(text) {
1352
1352
  for (const line of text.split("\n")) for (const sentence of sentencesOf(line)) if (OUTPUT_MARKUP.test(sentence) || BARRED.test(sentence) && /\d/.test(sentence)) return sentence.trim();
1353
1353
  }
1354
1354
  // src/shared/import-card.ts
1355
+ const IMPORT_PAUSES = [
1356
+ "never",
1357
+ "survey",
1358
+ "stages"
1359
+ ];
1360
+ /** What the pause is for a card: the choice, or the default for its size. */
1361
+ const pauseOf = (choices, entries) => choices.pause ?? (entries >= 30 ? "stages" : "never");
1355
1362
  /** The command that imports the card waiting in a world, in the world's authoring chat. */
1356
1363
  const IMPORT_COMMAND = "/import-st";
1357
1364
  /** What follows the command's name: the card it names, then what the person asks for. The card is always the one in the world's import folder; only the request is passed on. */
@@ -1917,7 +1924,8 @@ function defaultChoices(card) {
1917
1924
  return {
1918
1925
  name: card.name.slice(0, 200),
1919
1926
  disabledEntries: (card.book?.entries ?? []).filter((entry) => !entry.enabled).map((entry) => entry.id),
1920
- opening
1927
+ opening,
1928
+ pause: pauseOf({}, (card.book?.entries ?? []).length)
1921
1929
  };
1922
1930
  }
1923
1931
  /** The text of the opening a choice names; nothing when the choice is none or names nothing. */
@@ -1950,11 +1958,15 @@ function parseChoices(value) {
1950
1958
  index: raw["index"]
1951
1959
  };
1952
1960
  else if (raw?.["kind"] !== "none") problems.push("opening must be first, alternate with an index, or none");
1961
+ if (input["fetchPictures"] !== void 0 && typeof input["fetchPictures"] !== "boolean") problems.push("fetchPictures must be true or false");
1962
+ if (input["pause"] !== void 0 && !IMPORT_PAUSES.includes(input["pause"])) problems.push(`pause must be one of ${IMPORT_PAUSES.join(", ")}`);
1953
1963
  if (problems.length > 0) throw new InvalidEditProblems(problems);
1954
1964
  return {
1955
1965
  name,
1956
1966
  disabledEntries: [...new Set(disabled)],
1957
- opening
1967
+ opening,
1968
+ ...input["fetchPictures"] === false ? { fetchPictures: false } : {},
1969
+ ...input["pause"] === void 0 ? {} : { pause: input["pause"] }
1958
1970
  };
1959
1971
  }
1960
1972
  async function readJson(file) {
@@ -2870,7 +2882,28 @@ function parseStartQuestionsEdit(value, problems) {
2870
2882
  }
2871
2883
  const MAX_OPENING_TEXT = 2e4;
2872
2884
  /** The words of an opening as one text: its parts, a blank line between. */
2873
- const partsText = (parts) => parts.map((part) => part.text).join("\n\n");
2885
+ const partsText = (parts) => parts.flatMap((part) => part.type === "image" ? [] : [part.text]).join("\n\n");
2886
+ /** The folders of a world's `images/` that a story starts with a copy of; an opening may show a picture from any of them. */
2887
+ const IMAGE_FOLDERS = [
2888
+ "library",
2889
+ "characters",
2890
+ "locations",
2891
+ "items",
2892
+ "global"
2893
+ ];
2894
+ /** Whether a path names a picture of a world's `images/` that its stories carry: relative, in one of the copied folders, with no dot segments and no backslashes. */
2895
+ function isImagePath(path) {
2896
+ const segments = path.split("/");
2897
+ const extension = /\.([a-z0-9]+)$/i.exec(path)?.[1]?.toLowerCase();
2898
+ const served = extension === "png" || segments[0] === "library" && [
2899
+ "jpg",
2900
+ "jpeg",
2901
+ "webp",
2902
+ "gif",
2903
+ "avif"
2904
+ ].includes(extension ?? "");
2905
+ return path.length <= 300 && served && !path.includes("\\") && segments.length >= 2 && IMAGE_FOLDERS.includes(segments[0]) && segments.every((segment) => segment !== "" && segment !== "." && segment !== "..");
2906
+ }
2874
2907
  /** Whether any part is spoken by a character: an opening with none is only narration, which a plain text says as well. */
2875
2908
  const hasSpeech = (parts) => parts.some((part) => part.type === "utterance");
2876
2909
  /**
@@ -2891,8 +2924,17 @@ function parseOpeningParts(value, where, problems) {
2891
2924
  }
2892
2925
  const part = entry;
2893
2926
  const type = part["type"] ?? "narration";
2894
- if (type !== "narration" && type !== "utterance") {
2895
- problems.push(`${at}.type must be "narration" or "utterance"`);
2927
+ if (type !== "narration" && type !== "utterance" && type !== "image") {
2928
+ problems.push(`${at}.type must be "narration", "utterance" or "image"`);
2929
+ continue;
2930
+ }
2931
+ if (type === "image") {
2932
+ const path = typeof part["path"] === "string" ? part["path"].trim() : "";
2933
+ if (!isImagePath(path)) problems.push(`${at}.path must name a picture of the library, like library/dock.png`);
2934
+ else parts.push({
2935
+ type,
2936
+ path
2937
+ });
2896
2938
  continue;
2897
2939
  }
2898
2940
  if (typeof part["text"] !== "string") {
@@ -3191,7 +3233,21 @@ function readRules(reader) {
3191
3233
  function readParts(reader, key) {
3192
3234
  const parts = [];
3193
3235
  for (const part of reader.objects(key)) {
3194
- const type = part.oneOf("type", ["narration", "utterance"], "narration");
3236
+ const type = part.oneOf("type", [
3237
+ "narration",
3238
+ "utterance",
3239
+ "image"
3240
+ ], "narration");
3241
+ if (type === "image") {
3242
+ const path = part.string("path", { required: true })?.trim();
3243
+ if (path === void 0) continue;
3244
+ if (!isImagePath(path)) part.fail("path", "must name a picture of the library, like library/dock.png");
3245
+ else parts.push({
3246
+ type,
3247
+ path
3248
+ });
3249
+ continue;
3250
+ }
3195
3251
  const text = part.string("text", { required: true })?.trim();
3196
3252
  if (text === void 0 || text === "") continue;
3197
3253
  if (type === "narration") {
@@ -3496,6 +3552,12 @@ const ROLES = [
3496
3552
  "template",
3497
3553
  "irrelevant"
3498
3554
  ];
3555
+ const KINDS = [
3556
+ "character",
3557
+ "place",
3558
+ "faction",
3559
+ "thing"
3560
+ ];
3499
3561
  /** One place that says what every role means to the import; the stages ask the predicates below instead of listing roles. */
3500
3562
  const ROLE_TABLE = {
3501
3563
  character: {
@@ -3555,6 +3617,7 @@ const ROLE_TABLE = {
3555
3617
  };
3556
3618
  /** The role a piece is mostly about: the first the classifier named. */
3557
3619
  const mainRole = (piece) => piece.roles[0];
3620
+ const kindOfRole = (role) => ROLE_TABLE[role].entity;
3558
3621
  const playsRole = (piece, role) => piece.roles.includes(role);
3559
3622
  const isLeftOut = (piece) => piece.roles.every((role) => ROLE_TABLE[role].leftOut);
3560
3623
  /** A piece that is only guidance on making people, places or things up while the story is played: the names in it are kinds and examples, not entities of the world. */
@@ -3936,6 +3999,40 @@ function findEntity(roster, name, kind) {
3936
3999
  }));
3937
4000
  return near.length === 1 ? near[0] : void 0;
3938
4001
  }
4002
+ // src/host/import/passages.ts
4003
+ /** Finding a model's copy of a passage in the text it was copied from. */
4004
+ const squeezed = (text) => text.replace(/\s+/g, " ").trim();
4005
+ /** The letters and digits of a text, folded, each with where it stands in the text: two copies of a passage that differ only in spacing, quotes, markup or punctuation have the same ones. */
4006
+ function lettersOf(text) {
4007
+ let letters = "";
4008
+ const at = [];
4009
+ for (let index = 0; index < text.length; index += 1) {
4010
+ const char = text[index];
4011
+ if (!/[\p{L}\p{N}]/u.test(char)) continue;
4012
+ const folded = char.normalize("NFKC").toLowerCase();
4013
+ for (let part = 0; part < folded.length; part += 1) {
4014
+ letters += folded[part];
4015
+ at.push(index);
4016
+ }
4017
+ }
4018
+ return {
4019
+ letters,
4020
+ at
4021
+ };
4022
+ }
4023
+ /** The fewest letters a passage must have to be found by its letters alone: a shorter one could be anywhere. */
4024
+ const MIN_SNAP_LETTERS = 12;
4025
+ /** A passage as the piece has it: the passage itself when the piece holds it (whatever its spacing), else the stretch of the piece with the same letters in the same order, else nothing. */
4026
+ function snapPassage(passage, source) {
4027
+ if (squeezed(passage) === "") return void 0;
4028
+ if (squeezed(source).includes(squeezed(passage))) return passage;
4029
+ const wanted = lettersOf(passage).letters;
4030
+ if (wanted.length < MIN_SNAP_LETTERS) return void 0;
4031
+ const whole = lettersOf(source);
4032
+ const found = whole.letters.indexOf(wanted);
4033
+ if (found < 0) return void 0;
4034
+ return source.slice(whole.at[found], whole.at[found + wanted.length - 1] + 1);
4035
+ }
3939
4036
  // src/host/import/extract.ts
3940
4037
  const emptyExtracted = () => ({
3941
4038
  characters: [],
@@ -4421,12 +4518,10 @@ const MIN_GUIDANCE_CHARS = 120;
4421
4518
  /** The most characters of standing rules the game master carries on every turn; the rest of what the card always sends is found by search like any lore. */
4422
4519
  const STANDING_MAX_CHARS = 12e3;
4423
4520
  const STANDING_PROMPT = "roleplay/standing";
4424
- const squeezed = (text) => text.replace(/\s+/g, " ").trim();
4425
- /** Why the passages cannot be used, or nothing when each is in the piece word for word: the guidance is the card's, and a rewrite would be the model's. */
4521
+ /** Why the passages cannot be used, or nothing when each is in the piece word for word, or differs from it only in spacing, quotes and markup: the guidance is the card's, and a rewrite would be the model's. */
4426
4522
  function passageProblem(answer, source) {
4427
- const whole = squeezed(source);
4428
4523
  for (const field of ["casting", "rules"]) {
4429
- const missing = (Array.isArray(answer[field]) ? answer[field] : []).findIndex((passage) => typeof passage !== "string" || squeezed(passage) === "" || !whole.includes(squeezed(passage)));
4524
+ const missing = (Array.isArray(answer[field]) ? answer[field] : []).findIndex((passage) => typeof passage !== "string" || snapPassage(passage, source) === void 0);
4430
4525
  if (missing >= 0) return `${field} passage ${missing + 1} is not in the piece word for word: copy it exactly as written, or leave it out`;
4431
4526
  }
4432
4527
  }
@@ -4441,7 +4536,6 @@ function guidanceEntry(passages, title) {
4441
4536
  body
4442
4537
  };
4443
4538
  }
4444
- /** What a prompt file cannot hold is changed so that `${` and `{{` in a card's text are not read as variables. */
4445
4539
  const inert = (text) => text.replace(/\$\{/g, "$ {").replace(/\{\{/g, "{ {");
4446
4540
  const LORE_SCHEMA = {
4447
4541
  type: "object",
@@ -4552,6 +4646,8 @@ function asWritten(item) {
4552
4646
  /** The entries of a piece must hold at least this share of its text, from a piece of at least `MIN_CHECKED_CHARS` characters: the facts are kept, not summarised away. */
4553
4647
  const MIN_LORE_SHARE = .5;
4554
4648
  const MIN_CHECKED_CHARS = 300;
4649
+ /** How often a model that writes unusable entries for a piece is told before the piece goes in as the card wrote it. */
4650
+ const LORE_REFUSALS = 2;
4555
4651
  /** Why the entries made of a piece cannot be used, or nothing when they can. */
4556
4652
  function loreProblem(answer, roster, source) {
4557
4653
  const entries = loreDocuments(answer, roster, /* @__PURE__ */ new Set());
@@ -4817,11 +4913,17 @@ async function startingPlaces(ctx, card, items, classified, roster, results) {
4817
4913
  }
4818
4914
  return made;
4819
4915
  }
4820
- /** Makes the documents of every entity of the roster, and the lore from the pieces about the world. */
4821
- async function extractEntities(ctx, card, items, classified, roster) {
4822
- const result = emptyExtracted();
4823
- const entityResults = await mapLimit(roster, ctx.concurrency, async (entity, index) => {
4824
- ctx.say(`writing ${entity.kind} ${index + 1}/${roster.length}: ${entity.name}`);
4916
+ const GROUPS = {
4917
+ character: "characters",
4918
+ place: "locations",
4919
+ faction: "factions",
4920
+ thing: "items"
4921
+ };
4922
+ /** Writes the document of every entity of one kind, one job each. A job that fails leaves a note instead of the entity. */
4923
+ async function writeEntities(ctx, card, items, classified, roster, kind) {
4924
+ const mine = roster.filter((entity) => entity.kind === kind);
4925
+ return await mapLimit(mine, ctx.concurrency, async (entity, index) => {
4926
+ ctx.say(`writing ${entity.kind} ${index + 1}/${mine.length}: ${entity.name}`);
4825
4927
  const sources = sourcesFor(entity, items, classified);
4826
4928
  try {
4827
4929
  const answer = await ctx.run(jobFor(ctx.text, trOf(ctx), entity, sources, roster, card));
@@ -4841,23 +4943,38 @@ async function extractEntities(ctx, card, items, classified, roster) {
4841
4943
  };
4842
4944
  }
4843
4945
  });
4844
- entityResults.push(...await startingPlaces(ctx, card, items, classified, roster, entityResults));
4845
- for (const { entity, built, failure } of entityResults) {
4946
+ }
4947
+ function collect(result, written) {
4948
+ for (const { entity, built, failure } of written) {
4846
4949
  if (failure !== void 0 || built === void 0) {
4847
4950
  result.notes.push(failure ?? `${entity.name}: nothing was written`);
4848
4951
  continue;
4849
4952
  }
4850
4953
  result.notes.push(...built.notes);
4851
4954
  if (entity.kind === "thing" && built.document["held_by"] === void 0 && built.document["location"] === void 0) continue;
4852
- result[{
4853
- character: "characters",
4854
- place: "locations",
4855
- faction: "factions",
4856
- thing: "items"
4857
- }[entity.kind]].push(built.document);
4858
- }
4859
- const itemIds = new Set(result.items.map((entry) => String(entry["id"])));
4860
- for (const { entity, built } of entityResults) {
4955
+ result[GROUPS[entity.kind]].push(built.document);
4956
+ }
4957
+ return result;
4958
+ }
4959
+ /** The places of the roster. */
4960
+ async function extractPlaces(ctx, card, items, classified, roster) {
4961
+ return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "place"));
4962
+ }
4963
+ /** The organisations of the roster. */
4964
+ async function extractFactions(ctx, card, items, classified, roster) {
4965
+ return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "faction"));
4966
+ }
4967
+ /** The things of the roster (one nobody holds or keeps anywhere is left out). */
4968
+ async function extractThings(ctx, card, items, classified, roster) {
4969
+ return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "thing"));
4970
+ }
4971
+ /** The characters of the roster, the places their starts name that the roster lacks, and what each has on them that the roster does not list as a thing. */
4972
+ async function extractCharacters(ctx, card, items, classified, roster) {
4973
+ const written = await writeEntities(ctx, card, items, classified, roster, "character");
4974
+ written.push(...await startingPlaces(ctx, card, items, classified, roster, written));
4975
+ const result = collect(emptyExtracted(), written);
4976
+ const itemIds = new Set(roster.filter((entity) => entity.kind === "thing").map((entity) => entity.key));
4977
+ for (const { entity, built } of written) {
4861
4978
  if (entity.kind !== "character") continue;
4862
4979
  for (const name of built?.carried ?? []) {
4863
4980
  if (findEntity(roster, name, "thing") !== void 0 || result.items.some((entry) => norm(String(entry["name"])) === norm(name) && entry["held_by"] === entity.key)) continue;
@@ -4868,22 +4985,40 @@ async function extractEntities(ctx, card, items, classified, roster) {
4868
4985
  });
4869
4986
  }
4870
4987
  }
4988
+ return result;
4989
+ }
4990
+ /** The background of the world: lore from the pieces about it, what a generator piece says, and the passages that lay down rules or how people are made up. */
4991
+ async function extractBackground(ctx, card, items, classified, roster) {
4992
+ const result = emptyExtracted();
4871
4993
  const worldItems = items.filter((item) => statesWorldFacts(classified[item.id] ?? { roles: [] }));
4872
4994
  const taken = /* @__PURE__ */ new Set();
4873
4995
  const loreResults = await mapLimit(worldItems, ctx.concurrency, async (item, index) => {
4874
4996
  ctx.say(`writing background ${index + 1}/${worldItems.length}: ${item.label}`);
4875
4997
  try {
4876
4998
  const tr = trOf(ctx);
4999
+ let refusals = 0;
4877
5000
  const prompt = `${tr("Card: {name}", { name: card.name })}\n${tr("Piece: {label}", { label: item.label })}${item.title === "" ? "" : `\n${tr("Title: {title}", { title: item.title })}`}\n\n${tr("The entities of this world, which are the only ones the entries may name as subjects:")}\n${rosterLines(roster, tr)}\n\n${tr("Source piece:")}\n${item.text.slice(0, 5500)}`;
5001
+ const answer = await ctx.run({
5002
+ persona: ctx.text("import/lore", { rules: ctx.text("import/common-rules") }),
5003
+ maxTokens: 1500 + item.text.length,
5004
+ prompt,
5005
+ result: LORE_SCHEMA,
5006
+ check: (value) => {
5007
+ const problem = loreProblem(value, roster, item.text);
5008
+ if (problem === void 0 || refusals >= LORE_REFUSALS) return void 0;
5009
+ refusals += 1;
5010
+ return problem;
5011
+ }
5012
+ });
5013
+ const still = loreProblem(answer, roster, item.text);
5014
+ if (still !== void 0) return {
5015
+ item,
5016
+ answer: asWritten(item),
5017
+ failure: `${item.label}: kept as the card wrote it, because the model's entries were not usable (${still})`
5018
+ };
4878
5019
  return {
4879
5020
  item,
4880
- answer: await ctx.run({
4881
- persona: ctx.text("import/lore", { rules: ctx.text("import/common-rules") }),
4882
- maxTokens: 1500 + item.text.length,
4883
- prompt,
4884
- result: LORE_SCHEMA,
4885
- check: (value) => loreProblem(value, roster, item.text)
4886
- })
5021
+ answer
4887
5022
  };
4888
5023
  } catch (error) {
4889
5024
  return {
@@ -4915,18 +5050,26 @@ async function extractEntities(ctx, card, items, classified, roster) {
4915
5050
  ctx.say(`looking for guidance on making things up and for standing rules ${index + 1}/${searched.length}: ${item.label}`);
4916
5051
  try {
4917
5052
  const prompt = `${tr("Card: {name}", { name: card.name })}\n${tr("Piece: {label}", { label: item.label })}\n\n${tr("Source piece:")}\n${item.text.slice(0, 5500)}`;
5053
+ let refused = false;
4918
5054
  const answer = await ctx.run({
4919
5055
  persona: ctx.text("import/generator", { rules: ctx.text("import/common-rules") }),
4920
5056
  maxTokens: 600 + item.text.length,
4921
5057
  prompt,
4922
5058
  result: GUIDANCE_SCHEMA,
4923
- check: (value) => passageProblem(value, item.text)
5059
+ check: (value) => {
5060
+ const problem = passageProblem(value, item.text);
5061
+ if (problem === void 0 || refused) return void 0;
5062
+ refused = true;
5063
+ return problem;
5064
+ }
4924
5065
  });
4925
- const passages = (field) => answer[field].map(withoutOutputMarkup).filter((passage) => passage.trim() !== "");
5066
+ const passages = (field) => answer[field].map((passage) => snapPassage(passage, item.text)).filter((passage) => passage !== void 0).map(withoutOutputMarkup).filter((passage) => passage.trim() !== "");
5067
+ const lost = answer["casting"].length + answer["rules"].length - passages("casting").length - passages("rules").length;
4926
5068
  return {
4927
5069
  item,
4928
5070
  casting: passages("casting"),
4929
- rules: passages("rules")
5071
+ rules: passages("rules"),
5072
+ ...lost > 0 ? { failure: `${item.label}: ${lost} passage${lost === 1 ? " was" : "s were"} not in the piece word for word and left out` } : {}
4930
5073
  };
4931
5074
  } catch (error) {
4932
5075
  return {
@@ -4968,6 +5111,19 @@ async function extractEntities(ctx, card, items, classified, roster) {
4968
5111
  id: STANDING_PROMPT,
4969
5112
  text: inert(standing)
4970
5113
  });
5114
+ return result;
5115
+ }
5116
+ /** The documents of several stages as one: what each made, in the order given. */
5117
+ function mergeExtracted(parts) {
5118
+ const merged = emptyExtracted();
5119
+ for (const part of parts) for (const key of Object.keys(merged)) {
5120
+ const more = part[key];
5121
+ if (more !== void 0) merged[key].push(...more);
5122
+ }
5123
+ return merged;
5124
+ }
5125
+ /** What is left to do once every stage has written its documents: places for characters that start nowhere, links and knowledge that name what does not exist, awareness a relationship implies. */
5126
+ function settleExtracted(result, items, classified, roster) {
4971
5127
  placeAtScenario(result, items, classified, roster);
4972
5128
  pruneLoreSubjects(result);
4973
5129
  pruneMembers(result);
@@ -5367,6 +5523,6 @@ var SerialQueue = class {
5367
5523
  return this.tails.size;
5368
5524
  }
5369
5525
  };
5370
- export { sha as $, LOCATION_FILE_NAME as $t, routeVerdicts as A, openingText as At, questionView as B, parseThingEdit as Bt, ROLE_TABLE as C, itemise as Ct, mergeReports as D, ImportNotFoundError as Dt, askYesNo as E, IMPORT_FOLDER as Et, parseWorldInfoEdit as F, parseCharacterEdit as Ft, deletePreset as G, dialectOf as Gt, PRESET_FILE as H, importRequestOf as Ht, hasSpeech as I, parseFactionEdit as It, loadPreset as J, loadVariables as Jt, isPresetName as K, sourceSummary as Kt, parseOpeningParts as L, parseLoreEdit as Lt, WORLD_FILE_NAME as M, readImportFolder as Mt, parseWorldFile as N, writeChoices as Nt, modeFor as O, ImportStore as Ot, MAX_OPENING_CHARS as P, InvalidEditProblems as Pt, savePresetFromWorld as Q, parseLoreFile as Qt, partsText as R, parsePlaceEdit as Rt, ROLES as S, cleanText as St, announceProblem as T, withPlayer as Tt, createPresetFromGuidance as U, findPanel as Ut, startQuestionsToFile as V, IMPORT_COMMAND as Vt, createPresetFromShipped as W, splitPanels as Wt, readPreset as X, variableProblems as Xt, presetDirectory as Y, parseVariablesFile as Yt, reservePreset as Z, LORE_FILE_NAME as Zt, pruneRelationships as _, updateLorebookInfo as _t, characterDocument as a, FACTION_FILE_NAME as an, writeWorldPrompt as at, classifyItems as b, loadLore as bt, extractStyle as c, parseCharacterFile as cn, deleteLorebook as ct, inert as d, LORE_SCOPES as dn, isLorebookName as dt, parseLocationFile as en, updatePresetInfo as et, loreDocuments as f, WEEKDAY_NAMES as fn, listLorebooks as ft, pruneMembers as g, reserveLorebook as gt, pruneLoreSubjects as h, readLorebook as ht, asWritten as i, parseSlotsFile as in, readWorldPrompt as it, yesAt as j, parseChoices as jt, noAt as k, PICTURE_FILE as kt, extractStyleFrom as l, guarded as ln, deleteLorebookEntry as lt, pruneLinks as m, INTENT_STATUSES as mn, lorebookDirectory as mt, STANDING_PROMPT as n, SLOTS_FILE_NAME as nn, deleteWorldPrompt as nt, emptyExtracted as o, parseFactionFile as on, addLorebookEntries as ot, pruneKnowledge as p, DEFAULT_SLOTS as pn, loadLorebook as pt, listPresets as q, VARIABLES_FILE_NAME as qt, addLore as r, parseItemFile as rn, listWorldPrompts as rt, extractEntities as s, CHARACTER_FILE_NAME as sn, createLorebook as st, SerialQueue as t, ITEM_FILE_NAME as tn, PROSE_PROMPTS as tt, extractVariables as u, LORE_KINDS as un, entriesOf as ut, sourcesFor as v, writeLorebookEntry as vt, isLeftOut as w, partsOf as wt, findEntity as x, subfolders as xt, buildRoster as y, LORE_DIR as yt, combineAnswers as z, parseRelationEdit as zt };
5526
+ export { createPresetFromShipped as $, findPanel as $t, ROLES as A, subfolders as At, yesAt as B, parseChoices as Bt, settleExtracted as C, DEFAULT_SLOTS as Cn, lorebookDirectory as Ct, classifyItems as D, writeLorebookEntry as Dt, buildRoster as E, updateLorebookInfo as Et, askYesNo as F, IMPORT_FOLDER as Ft, hasSpeech as G, parseFactionEdit as Gt, parseWorldFile as H, writeChoices as Ht, mergeReports as I, ImportNotFoundError as It, combineAnswers as J, parseRelationEdit as Jt, parseOpeningParts as K, parseLoreEdit as Kt, modeFor as L, ImportStore as Lt, isLeftOut as M, itemise as Mt, kindOfRole as N, partsOf as Nt, findEntity as O, LORE_DIR as Ot, announceProblem as P, withPlayer as Pt, createPresetFromGuidance as Q, pauseOf as Qt, noAt as R, PICTURE_FILE as Rt, pruneRelationships as S, WEEKDAY_NAMES as Sn, loadLorebook as St, snapPassage as T, reserveLorebook as Tt, MAX_OPENING_CHARS as U, InvalidEditProblems as Ut, WORLD_FILE_NAME as V, readImportFolder as Vt, parseWorldInfoEdit as W, parseCharacterEdit as Wt, startQuestionsToFile as X, IMPORT_COMMAND as Xt, questionView as Y, parseThingEdit as Yt, PRESET_FILE as Z, importRequestOf as Zt, mergeExtracted as _, CHARACTER_FILE_NAME as _n, deleteLorebook as _t, characterDocument as a, parseVariablesFile as an, readPreset as at, pruneLoreSubjects as b, LORE_KINDS as bn, isLorebookName as bt, extractCharacters as c, parseLoreFile as cn, sha as ct, extractStyle as d, ITEM_FILE_NAME as dn, deleteWorldPrompt as dt, splitPanels as en, deletePreset as et, extractStyleFrom as f, SLOTS_FILE_NAME as fn, listWorldPrompts as ft, loreDocuments as g, parseFactionFile as gn, createLorebook as gt, inert as h, FACTION_FILE_NAME as hn, addLorebookEntries as ht, asWritten as i, loadVariables as in, presetDirectory as it, ROLE_TABLE as j, cleanText as jt, KINDS as k, loadLore as kt, extractFactions as l, LOCATION_FILE_NAME as ln, updatePresetInfo as lt, extractVariables as m, parseSlotsFile as mn, writeWorldPrompt as mt, STANDING_PROMPT as n, sourceSummary as nn, listPresets as nt, emptyExtracted as o, variableProblems as on, reservePreset as ot, extractThings as p, parseItemFile as pn, readWorldPrompt as pt, partsText as q, parsePlaceEdit as qt, addLore as r, VARIABLES_FILE_NAME as rn, loadPreset as rt, extractBackground as s, LORE_FILE_NAME as sn, savePresetFromWorld as st, SerialQueue as t, dialectOf as tn, isPresetName as tt, extractPlaces as u, parseLocationFile as un, PROSE_PROMPTS as ut, pruneKnowledge as v, parseCharacterFile as vn, deleteLorebookEntry as vt, sourcesFor as w, INTENT_STATUSES as wn, readLorebook as wt, pruneMembers as x, LORE_SCOPES as xn, listLorebooks as xt, pruneLinks as y, guarded as yn, entriesOf as yt, routeVerdicts as z, openingText as zt };
5371
5527
 
5372
- //# sourceMappingURL=serial-DnVqMDe5.js.map
5528
+ //# sourceMappingURL=serial-xcAG57p_.js.map
@@ -264,6 +264,9 @@ const ZH = {
264
264
  "(none: write only what the name itself implies, and leave the rest empty)": "(无:只写名字本身能推出的内容,其余留空)",
265
265
  "The entities of this world, which are the only ones the entries may name as subjects:": "这个世界里的对象,条目只能以它们作为主题:",
266
266
  "Source piece:": "来源片段:",
267
+ "`{tool}` failed {count} times in a row in this turn, with different arguments each time, so guessing more will not work. Do not call it again this turn: use another tool to find what you need (a search or an overview), or finish and say what is left.": "`{tool}` 在本回合内已连续失败 {count} 次,每次参数都不同,继续猜测不会奏效。本回合不要再调用它:改用别的工具(搜索或总览)查找所需内容,或者结束并说明还剩什么。",
268
+ "A note from the person importing the card, for this step. Follow it where the card allows; it never overrides the rules above:": "导入卡片的用户为这一步写的要求。卡片允许的范围内请照做;它不会覆盖上面的规则:",
269
+ "The person restored this world to the checkpoint \"{label}\" ({at}): every file is as it was then, and what you edited since is gone. Read the world again before you edit, and do not rely on what you remember of it.": "用户已把这个世界还原到检查点“{label}”({at}):每个文件都恢复为当时的内容,你此后所做的编辑已不复存在。编辑之前请重新读取世界,不要依赖你记得的内容。",
267
270
  "This exact call was already made {count} times in this turn with the same result. Do not repeat it: go on with the next step, or finish and say what is left.": "这个完全相同的调用在本回合内已经执行了 {count} 次,结果相同。不要再重复:继续下一步,或者结束并说明还剩什么。",
268
271
  "{label}: how people are made up": "{label}:人物如何生成",
269
272
  "{label}: rules and mechanics": "{label}:规则与机制",
@@ -348,4 +351,4 @@ function withoutExtension(value) {
348
351
  }
349
352
  export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
350
353
 
351
- //# sourceMappingURL=text-B-HsLdb-.js.map
354
+ //# sourceMappingURL=text-KnqhN_Zv.js.map
@@ -1,5 +1,5 @@
1
1
  import { D as finishOf, E as cutOff } from "./child-Bfj7-Iuo.js";
2
- import { r as guardRepeatedCalls } from "./hooks-P_--KSFl.js";
2
+ import { r as guardRepeatedCalls } from "./hooks-CnxV2uEh.js";
3
3
  import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
4
4
  // src/host/authoring/turn-guard.ts
5
5
  /**
@@ -49,4 +49,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
49
49
  }
50
50
  export { guardAuthoringTurns as t };
51
51
 
52
- //# sourceMappingURL=turn-guard-D4YHE00t.js.map
52
+ //# sourceMappingURL=turn-guard-CfsGepCg.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-agentic-roleplay/core",
3
- "version": "0.12.6",
3
+ "version": "0.13.0",
4
4
  "description": "Core plugin of the agentic roleplay bundle for DeepSeek Harness: roleplay UI, orchestration and storage.",
5
5
  "author": {
6
6
  "name": "Firefox2100",
@@ -80,13 +80,14 @@
80
80
  "@deepseek-ai/schemastery": "^3.18.5"
81
81
  },
82
82
  "dependencies": {
83
- "@dsh-agentic-roleplay/state": "0.12.6"
83
+ "@dsh-agentic-roleplay/state": "0.13.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@deepseek-ai/cordis": "^4.1.0",
87
87
  "@deepseek-ai/cordis-plugin-loader": "^1.1.0",
88
88
  "@deepseek-ai/dsh-agent": ">=0.2.2-rc.3 <0.2.3",
89
89
  "@deepseek-ai/dsh-agent-loop": ">=0.2.2-rc.3 <0.2.3",
90
+ "@deepseek-ai/dsh-attachment": ">=0.2.2-rc.3 <0.2.3",
90
91
  "@deepseek-ai/dsh-client-locale": ">=0.2.2-rc.3 <0.2.3",
91
92
  "@deepseek-ai/dsh-client-store": ">=0.2.2-rc.3 <0.2.3",
92
93
  "@deepseek-ai/dsh-client-ui-chat": ">=0.2.2-rc.3 <0.2.3",
@@ -9,3 +9,5 @@ The import already turned the card's instructions about narration and behaviour
9
9
  The report also says how many variables the card's panels and meters became (variables.json), how many of the card's other greetings the world offers as openings to choose from when a session starts, and whether the card's picture became the portrait of its character. Mention them briefly.
10
10
 
11
11
  The report comes with `checks`: the checks the program runs on every import, already run and stored with the world (consistency of the world, comparison with the card, authoring quality). Read the findings. An error is for you to fix. A warning is a pointer: read the piece of the card with card_read, then fix what is wrong or say why you left it. An info is only worth a mention. The checks a model judges are not run yet. Run check_card with deep true when the card was long or many of its pieces were rewritten into lore, or when the quick findings show facts lost or made up; run check_quality with deep true when the cast has bare sheets or the world looks thin. After fixing, run the tool again to see that the finding is gone. Do not run them just to run them, and do not fill a gap with something the card does not say.
12
+
13
+ The pictures the card's addresses pointed to were downloaded into the world's image library, and each carries the addresses it came from and the card pieces that held them. Call list_world_images. For a picture that has no description, or whose card piece says who it shows, read that piece with card_read (the text around the address) and put the facts you can verify there into the picture: describe_world_image with that text as context writes the description and subjects, and edit_world_image corrects them. Name a character, place or thing only when the card text or the picture itself makes it clear; leave a picture you are unsure of as it is and say so. Never add what the card does not say.
@@ -0,0 +1 @@
1
+ Call ${next} next, with card "${card}".
@@ -0,0 +1 @@
1
+ Stop here and report to the person, as the pause for this import says: what this stage wrote, what failed or was left out and why, and what is left (${left}). Do not run the next stage in this turn.
@@ -0,0 +1 @@
1
+ Stop here and report to the person, as the pause for this import says: who and what the world is made of, and what looked doubtful. Do not run a stage yet.