@dsh-agentic-roleplay/core 0.8.2 → 0.9.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 (40) hide show
  1. package/lib/{authoring-tools-BgmC2oqU.js → authoring-tools-CdHlvx32.js} +1909 -53
  2. package/lib/authoring.js +135 -32
  3. package/lib/client.js +347 -347
  4. package/lib/doctor.js +1 -1
  5. package/lib/{gallery-D1V4h8vh.js → gallery-BKh7eu80.js} +2 -2
  6. package/lib/{generator-CLPosooC.js → generator-DdZ1-sgv.js} +2 -2
  7. package/lib/{hooks-rQTTeOC4.js → hooks-CcQj_dJo.js} +2 -2
  8. package/lib/images.js +4 -4
  9. package/lib/index.js +14 -14
  10. package/lib/{library-Dfu0dgRj.js → library-QFL6Z_Nr.js} +2 -2
  11. package/lib/{lorebook-author-tools-BAaAqZZm.js → lorebook-author-tools-DWBnYo1E.js} +6 -6
  12. package/lib/lorebook-authoring.js +4 -4
  13. package/lib/orchestration.js +8 -8
  14. package/lib/{pack-jail-CN-314ln.js → pack-jail-BMy6NcCY.js} +21 -723
  15. package/lib/{packs-DIj5BEfq.js → packs-BREPSfHy.js} +2 -2
  16. package/lib/{presenter-agent-DR0KvLE0.js → presenter-agent-B49-_iUm.js} +4 -4
  17. package/lib/{preset-CscHj1-Y.js → preset-BqgY1Tz4.js} +3 -3
  18. package/lib/{preset-author-tools-CxluF8qc.js → preset-author-tools-BB_Dcv2o.js} +6 -6
  19. package/lib/preset-authoring.js +5 -5
  20. package/lib/{presets-HB8kJTaE.js → presets-Bwnrx7p0.js} +22 -11
  21. package/lib/{reflection-Dg1xtOTW.js → reflection-CUWG-6Qg.js} +6 -6
  22. package/lib/{text-DyRN4nDP.js → text-CbGQhK1-.js} +4 -3
  23. package/lib/{turn-guard-g_hDn0jR.js → turn-guard-Bb8Ew-1z.js} +2 -2
  24. package/package.json +2 -2
  25. package/prompts/en/checks/decide-sheet.md +1 -0
  26. package/prompts/en/checks/fidelity.md +7 -0
  27. package/prompts/en/checks/gaps.md +4 -0
  28. package/prompts/en/checks/notice.md +3 -0
  29. package/prompts/en/import/finish-draft.md +1 -1
  30. package/prompts/en/import/finish-ok.md +3 -1
  31. package/prompts/en/import/notice-repair.md +2 -2
  32. package/prompts/en/import/repair-again.md +2 -2
  33. package/prompts/zh/checks/decide-sheet.md +1 -0
  34. package/prompts/zh/checks/fidelity.md +7 -0
  35. package/prompts/zh/checks/gaps.md +4 -0
  36. package/prompts/zh/checks/notice.md +3 -0
  37. package/prompts/zh/import/finish-draft.md +1 -1
  38. package/prompts/zh/import/finish-ok.md +3 -1
  39. package/prompts/zh/import/notice-repair.md +2 -2
  40. package/prompts/zh/import/repair-again.md +2 -2
@@ -1,14 +1,13 @@
1
1
  import { a as chatSessionId } from "./access-CfQWbNZP.js";
2
- import { $ as loadValidatedWorld, At as CHARACTERS_DIR, Ct as loadFactions, D as fetchPictures, E as candidateUrls, F as serialized, Ht as authoringChatSessionId, I as WORLD_FILE_NAME, L as parseWorldFile, M as cardCharacter, Mt as subfolders, N as openingMessage, Ot as loadCalendar, P as writePortrait, St as FACTIONS_DIR, T as addressesToFetch, Vt as authoredWorldOf, _t as loadLore, bt as ITEMS_DIR, c as importPhase, ct as populateLocations, et as knowsCharacter, ft as populateVariables, g as writeSnapshot, gt as LORE_DIR, h as editsSince, ht as loadTriggers, i as contextOf, j as alternateOpenings, jt as loadCharacters, k as mergeReports, m as recordProvenance, mt as TRIGGERS_FILE_NAME, nt as populateCharacters, ot as populateItems, s as worldOf, vt as LOCATIONS_DIR, w as addressKey, xt as loadItems, yt as loadLocations } from "./authoring-tools-BgmC2oqU.js";
3
- import { A as sourcesFor, Ct as parseCharacterFile, Et as InvalidEditProblems, N as findEntity, Q as IMPORT_FOLDER, St as CHARACTER_FILE_NAME, Y as itemise, Z as withPlayer, at as writeChoices, bt as FACTION_FILE_NAME, ft as LORE_FILE_NAME, gt as ITEM_FILE_NAME, ht as parseLocationFile, it as readImportFolder, lt as loadVariables, mt as LOCATION_FILE_NAME, nt as openingText, pt as parseLoreFile, q as writeWorldPrompt, tt as PICTURE_FILE, vt as parseItemFile, x as extractStyleFrom, xt as parseFactionFile } from "./presets-HB8kJTaE.js";
4
- import { l as atomicWrite, m as parseSwitchboard, n as encodeOutput, u as atomicWriteJson } from "./narration-CjB_KwwY.js";
5
- import { B as loadPlots, F as STORY_LANGUAGES, H as plotReferenceProblems, I as isStoryLanguage, J as formatIssue, L as textLanguage, P as LANGUAGE_NAMES, V as parsePlotsFile, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, st as AgentUnavailableError, z as PLOTS_FILE_NAME } from "./hooks-rQTTeOC4.js";
6
- import { i as translator, r as languageOf } from "./text-DyRN4nDP.js";
7
- import { u as parseSampling } from "./child-lYYeOwl2.js";
8
- import { b as mapLimit, h as readImageFileMetadata, u as referenceImagePath, x as norm } from "./library-Dfu0dgRj.js";
9
- import { n as readPreset } from "./preset-CscHj1-Y.js";
10
- import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-DIj5BEfq.js";
11
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CLPosooC.js";
2
+ import { Bt as loadFactions, C as worldFieldChanges, D as UPDATE_FOLDER, F as editsSince, Ft as LOCATIONS_DIR, G as addressesToFetch, Gt as loadCalendar, I as writeSnapshot, It as loadLocations, Jt as loadCharacters, K as candidateUrls, Lt as ITEMS_DIR, Mt as loadTriggers, Nt as LORE_DIR, O as baseId, P as recordProvenance, Pt as loadLore, Q as writePortrait, Rt as loadItems, S as matchPieces, T as loadWorldParts, W as addressKey, Y as mergeReports, Yt as subfolders, Z as cardCharacter, _t as knowsCharacter, an as authoringChatSessionId, c as importPhase, gt as loadValidatedWorld, i as contextOf, in as authoredWorldOf, jt as TRIGGERS_FILE_NAME, k as cardPieces, q as fetchPictures, qt as CHARACTERS_DIR, s as worldOf, v as editWorldInfo, w as withScratchStory, zt as FACTIONS_DIR } from "./authoring-tools-CdHlvx32.js";
3
+ import { Ct as CHARACTER_FILE_NAME, Dt as InvalidEditProblems, Q as IMPORT_FOLDER, St as parseFactionFile, Z as withPlayer, _t as ITEM_FILE_NAME, at as writeChoices, gt as parseLocationFile, ht as LOCATION_FILE_NAME, it as readImportFolder, mt as parseLoreFile, pt as LORE_FILE_NAME, q as writeWorldPrompt, tt as PICTURE_FILE, ut as loadVariables, wt as parseCharacterFile, x as extractStyleFrom, xt as FACTION_FILE_NAME, yt as parseItemFile } from "./presets-Bwnrx7p0.js";
4
+ import { l as atomicWrite, n as encodeOutput, u as atomicWriteJson } from "./narration-CjB_KwwY.js";
5
+ import { B as loadPlots, F as STORY_LANGUAGES, H as plotReferenceProblems, I as isStoryLanguage, J as formatIssue, L as textLanguage, P as LANGUAGE_NAMES, V as parsePlotsFile, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, st as AgentUnavailableError, z as PLOTS_FILE_NAME } from "./hooks-CcQj_dJo.js";
6
+ import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
7
+ import { b as mapLimit, h as readImageFileMetadata, u as referenceImagePath } from "./library-QFL6Z_Nr.js";
8
+ import { n as readPreset } from "./preset-BqgY1Tz4.js";
9
+ import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-BREPSfHy.js";
10
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-DdZ1-sgv.js";
12
11
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
13
12
  import { existsSync, lstatSync, statSync } from "node:fs";
14
13
  import { randomUUID } from "node:crypto";
@@ -17,7 +16,7 @@ import { Session, SessionId } from "@deepseek-ai/dsh-session";
17
16
  import { ToolCallId, createMessage, createSystemMessage, createToolResultMessage } from "@deepseek-ai/dsh-llm";
18
17
  import { setApprovalPolicy } from "@deepseek-ai/dsh-user-approval";
19
18
  import { defineTool } from "@deepseek-ai/dsh-tools";
20
- import { createSessionStore, readTriggerDefinition, triggerReferenceProblems, writeCalendar } from "@dsh-agentic-roleplay/state";
19
+ import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
21
20
  // src/host/agent/opening.ts
22
21
  /** What the opening is reported to come from, where a chat shows the source of a message. */
23
22
  const OPENING_SOURCE = {
@@ -465,547 +464,6 @@ var AuthoringSessions = class {
465
464
  }, new AbortController().signal);
466
465
  }
467
466
  };
468
- // src/host/import/card-tools.ts
469
- /** The most of a piece one `card_read` returns; a long lorebook entry is read in turns. */
470
- const READ_CHARS = 6e3;
471
- const SNIPPET_CHARS = 240;
472
- const DEFAULT_HITS = 8;
473
- const MAX_HITS = 20;
474
- const baseId = (id) => id.replace(/#\d+$/, "");
475
- /** The folder inside `.import` where a newer version of the card waits to be applied to the world. */
476
- const UPDATE_FOLDER = "update";
477
- /** Everything the card holds, in the order the card has it. */
478
- function cardPieces(card, choices) {
479
- const read = new Set(itemise(card, choices).map((item) => baseId(item.id)));
480
- const field = (id, label, text) => text.trim() === "" ? [] : [{
481
- id,
482
- label,
483
- title: "",
484
- keys: [],
485
- text,
486
- used: read.has(id)
487
- }];
488
- return [
489
- ...field("field:description", "description", card.description),
490
- ...field("field:personality", "personality", card.personality),
491
- ...field("field:scenario", "scenario", card.scenario),
492
- ...field("field:example", "example messages", card.messageExample),
493
- ...field("field:first-message", "first message", card.firstMessage),
494
- ...card.alternateGreetings.flatMap((text, index) => field(`field:greeting-${index + 1}`, `alternate greeting ${index + 1}`, text)),
495
- ...field("field:creator-notes", "creator's notes", card.creatorNotes),
496
- ...field("field:system-prompt", "system prompt", card.systemPrompt),
497
- ...field("field:post-history", "post-history instructions", card.postHistoryInstructions),
498
- ...(card.book?.entries ?? []).filter((entry) => entry.content.trim() !== "").map((entry) => ({
499
- id: entry.id,
500
- label: entry.title === "" ? entry.id : `entry “${entry.title}”`,
501
- title: entry.title,
502
- keys: entry.keys,
503
- text: entry.content,
504
- used: read.has(entry.id),
505
- enabled: entry.enabled
506
- }))
507
- ];
508
- }
509
- async function optional(file) {
510
- try {
511
- return JSON.parse(await readFile(file, "utf8"));
512
- } catch (error) {
513
- if (error.code === "ENOENT") return void 0;
514
- throw error;
515
- }
516
- }
517
- /** The card kept in a world's import folder, and what the import made of it. The tools exist as long as the card does. */
518
- async function readSource(directory, withRecords, version = "current") {
519
- const folder = join(directory, IMPORT_FOLDER);
520
- let read;
521
- try {
522
- read = await readImportFolder(version === "new" ? join(folder, UPDATE_FOLDER) : folder);
523
- } catch (error) {
524
- if (error.code === "ENOENT") throw new Error(version === "new" ? "no newer version of the card is waiting to update this world" : "this world has no source card: it was not imported from one, or its .import folder was removed");
525
- throw error;
526
- }
527
- const records = withRecords && version === "current" ? {
528
- classified: await optional(join(folder, "classification.json")),
529
- roster: await optional(join(folder, "roster.json")),
530
- report: await optional(join(folder, "report.json"))
531
- } : {};
532
- return {
533
- card: read.card,
534
- choices: read.choices,
535
- pieces: cardPieces(read.card, read.choices),
536
- records
537
- };
538
- }
539
- const rolesOf = (classified, id) => {
540
- if (classified === void 0) return [];
541
- return [...new Set(Object.entries(classified).filter(([key]) => baseId(key) === id).flatMap(([, entry]) => entry.roles))];
542
- };
543
- function snippet(text, at, length) {
544
- const start = Math.max(0, at - Math.floor((SNIPPET_CHARS - length) / 2));
545
- const end = Math.min(text.length, start + SNIPPET_CHARS);
546
- return `${start > 0 ? "…" : ""}${text.slice(start, end).replace(/\s+/g, " ")}${end < text.length ? "…" : ""}`;
547
- }
548
- function searchPieces(pieces, query, limit) {
549
- const phrase = query.trim().toLowerCase();
550
- if (phrase === "") return [];
551
- const words = [...new Set(phrase.split(/[\s,;,、]+/).filter((word) => word.length >= (/^[\x00-\x7f]+$/.test(word) ? 3 : 2)))];
552
- const count = (text, needle) => {
553
- let n = 0;
554
- let first = -1;
555
- for (let at = text.indexOf(needle); at >= 0; at = text.indexOf(needle, at + needle.length)) {
556
- n += 1;
557
- if (first < 0) first = at;
558
- }
559
- return {
560
- n,
561
- first
562
- };
563
- };
564
- const look = (text) => {
565
- const lowered = text.toLowerCase();
566
- const whole = count(lowered, phrase);
567
- if (whole.n > 0) return {
568
- matches: whole.n,
569
- score: whole.n * 4 + 100,
570
- at: whole.first,
571
- length: phrase.length
572
- };
573
- const found = words.map((word) => ({
574
- word,
575
- ...count(lowered, word)
576
- })).filter((entry) => entry.n > 0);
577
- if (found.length === 0) return void 0;
578
- const best = found.reduce((a, b) => a.first <= b.first ? a : b, found[0]);
579
- return {
580
- matches: found.reduce((sum, entry) => sum + entry.n, 0),
581
- score: found.length * 10 + found.reduce((sum, entry) => sum + entry.n, 0),
582
- at: best.first,
583
- length: best.word.length
584
- };
585
- };
586
- return pieces.flatMap((piece) => {
587
- const inText = look(piece.text);
588
- if (inText !== void 0) return [{
589
- piece,
590
- in: "text",
591
- matches: inText.matches,
592
- score: inText.score,
593
- snippet: snippet(piece.text, inText.at, inText.length)
594
- }];
595
- const head = [piece.title, ...piece.keys].filter((part) => part !== "").join(" · ");
596
- const inHead = look(head);
597
- return inHead === void 0 ? [] : [{
598
- piece,
599
- in: "title or keys",
600
- matches: inHead.matches,
601
- score: inHead.score - 50,
602
- snippet: `${piece.title === "" ? "" : `title: ${piece.title}`}${piece.keys.length === 0 ? "" : `${piece.title === "" ? "" : "; "}keys: ${piece.keys.join(", ")}`}`
603
- }];
604
- }).sort((a, b) => b.score - a.score).slice(0, limit).map(({ piece, matches, in: where, snippet: text }) => ({
605
- piece,
606
- matches,
607
- in: where,
608
- snippet: text
609
- }));
610
- }
611
- const versionParameter = {
612
- type: "string",
613
- enum: ["current", "new"],
614
- description: "current (the default) is the card the world was made from; new is the newer version waiting to update it, when card_diff says there is one. Piece ids are those of that version."
615
- };
616
- const output = {
617
- schema: { type: "json" },
618
- render: (_args, value) => [{
619
- type: "text",
620
- text: JSON.stringify(value, null, 1)
621
- }]
622
- };
623
- const json = (value) => JSON.parse(JSON.stringify(value));
624
- const idOf = (exec) => {
625
- const chat = exec.agent?.session.id;
626
- const world = chat === void 0 ? void 0 : authoredWorldOf(chat);
627
- if (world === void 0) throw new Error("this tool is available only in a world authoring chat");
628
- return world;
629
- };
630
- /**
631
- * Read-only tools over the card a world was imported from, which stays in the world's `.import` folder: they work while that folder holds the card and say so when it does not.
632
- * `records` adds what the import made of the card (the role of each piece, who it was used for); it is off only when a test compares the agent with and without it.
633
- */
634
- function cardTools(worlds, options = {}) {
635
- const withRecords = options.records !== false;
636
- const source = async (exec, version = "current") => {
637
- const id = idOf(exec);
638
- const record = await worlds.find(id);
639
- if (record === void 0) throw new Error(`the authored world "${id}" no longer exists`);
640
- return await readSource(record.directory, withRecords, version);
641
- };
642
- const versionOf = (value) => {
643
- if (value === void 0 || value === "current") return "current";
644
- if (value === "new") return "new";
645
- throw new Error("version must be current or new");
646
- };
647
- const find = (pieces, id) => {
648
- const found = pieces.find((piece) => piece.id === id);
649
- if (found === void 0) throw new Error(`the card has no piece "${id}": use an id from card_overview or card_search`);
650
- return found;
651
- };
652
- return [
653
- defineTool({
654
- name: "card_overview",
655
- description: "The card this world was imported from, which is kept: its name, creator and tags, every piece of it (field, greeting or lorebook entry) with its size, and, from the import's own records, what each piece was taken to be and which characters, places and things were made from it. Start here when the person asks where something in the world came from.",
656
- parameters: {},
657
- output,
658
- isConcurrencySafe: () => true,
659
- async execute(_args, exec) {
660
- const { card, choices, pieces, records } = await source(exec);
661
- const madeFrom = entitiesByPiece({
662
- card,
663
- choices,
664
- pieces,
665
- records
666
- });
667
- const made = (id) => madeFrom.get(id) ?? [];
668
- return json({
669
- card: {
670
- name: card.name,
671
- creator: card.creator,
672
- version: card.characterVersion,
673
- tags: card.tags,
674
- format: card.sourceSpec,
675
- ignoredScripts: card.ignored.scripts
676
- },
677
- pieces: pieces.map((piece) => ({
678
- id: piece.id,
679
- label: piece.label,
680
- characters: piece.text.length,
681
- readByTheImport: piece.used,
682
- ...piece.enabled === void 0 ? {} : { switchedOnInCard: piece.enabled },
683
- ...withRecords ? {
684
- takenToBe: rolesOf(records.classified, piece.id),
685
- madeInto: made(piece.id)
686
- } : {}
687
- })),
688
- ...records.roster === void 0 ? {} : { imported: records.roster.map((entity) => ({
689
- name: entity.name,
690
- kind: entity.kind,
691
- aliases: entity.aliases,
692
- playedByThePlayer: entity.player
693
- })) },
694
- ...records.report === void 0 ? {} : {
695
- importNotes: records.report.notes,
696
- leftOut: records.report.leftOut
697
- },
698
- note: "The import's records are its own judgement and can be wrong or incomplete; check them against the text of the piece with card_read."
699
- });
700
- }
701
- }),
702
- defineTool({
703
- name: "card_search",
704
- description: "Searches everything the card says (fields, greetings, lorebook entries and their keys) for a name or phrase and returns the pieces that contain it, best first, each with a short snippet and whether it was found in the text or only in the title or keys of an entry. A hit is a pointer, not evidence: read the piece with card_read before you answer from it.",
705
- parameters: {
706
- query: {
707
- type: "string",
708
- required: true,
709
- description: "A name or phrase to look for, in the card's own language."
710
- },
711
- version: versionParameter,
712
- limit: {
713
- type: "number",
714
- description: `How many pieces to return, at most ${MAX_HITS} (default ${DEFAULT_HITS}).`
715
- }
716
- },
717
- output,
718
- isConcurrencySafe: () => true,
719
- async execute(args, exec) {
720
- const { pieces } = await source(exec, versionOf(args.version));
721
- const limit = Math.min(MAX_HITS, Math.max(1, Math.floor(typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : DEFAULT_HITS)));
722
- const hits = searchPieces(pieces, args.query, limit);
723
- return json({
724
- query: args.query,
725
- found: hits.length,
726
- hits: hits.map(({ piece, matches, in: where, snippet: text }) => ({
727
- piece: piece.id,
728
- label: piece.label,
729
- matches,
730
- foundIn: where,
731
- snippet: text
732
- }))
733
- });
734
- }
735
- }),
736
- defineTool({
737
- name: "card_read",
738
- description: `The text of one piece of the card, word for word as the card has it (the card's own placeholders such as {{user}} included). A long piece is read in turns of ${READ_CHARS} characters: when "next" is given, call again with that offset.`,
739
- parameters: {
740
- piece: {
741
- type: "string",
742
- required: true,
743
- description: "A piece id from card_overview, card_search or card_diff, such as field:description or entry:3."
744
- },
745
- version: versionParameter,
746
- offset: {
747
- type: "number",
748
- description: "Where to start reading, in characters (default 0)."
749
- }
750
- },
751
- output,
752
- isConcurrencySafe: () => true,
753
- async execute(args, exec) {
754
- const { pieces } = await source(exec, versionOf(args.version));
755
- const piece = find(pieces, args.piece);
756
- const from = Math.min(piece.text.length, Math.max(0, Math.floor(typeof args.offset === "number" && Number.isFinite(args.offset) ? args.offset : 0)));
757
- const to = Math.min(piece.text.length, from + READ_CHARS);
758
- return json({
759
- piece: piece.id,
760
- label: piece.label,
761
- ...piece.keys.length === 0 ? {} : { keys: piece.keys },
762
- from,
763
- to,
764
- of: piece.text.length,
765
- ...to < piece.text.length ? { next: to } : {},
766
- text: piece.text.slice(from, to)
767
- });
768
- }
769
- }),
770
- defineTool({
771
- name: "card_origin",
772
- description: "Where a character, place, organisation or thing of this world came from: the pieces of the card the import read to make it (the pieces about it first, then those that only mention it), with what each was taken to be. For a name the import did not make anything of, the pieces of the card that mention it. Then read the pieces with card_read to answer from their text.",
773
- parameters: { name: {
774
- type: "string",
775
- required: true,
776
- description: "The name or an alias, as the world or the card has it."
777
- } },
778
- output,
779
- isConcurrencySafe: () => true,
780
- async execute(args, exec) {
781
- const { card, choices, pieces, records } = await source(exec);
782
- const entity = records.roster === void 0 ? void 0 : findEntity(records.roster, args.name);
783
- if (entity === void 0 || records.classified === void 0) return json({
784
- name: args.name,
785
- madeByTheImport: false,
786
- mentions: searchPieces(pieces, args.name, DEFAULT_HITS).map(({ piece, in: where, snippet: text }) => ({
787
- piece: piece.id,
788
- label: piece.label,
789
- foundIn: where,
790
- snippet: text
791
- }))
792
- });
793
- return json({
794
- name: entity.name,
795
- kind: entity.kind,
796
- aliases: entity.aliases,
797
- madeByTheImport: true,
798
- usedPieces: originOf(card, choices, pieces, records, entity.name).map((entry) => ({
799
- piece: entry.piece,
800
- label: entry.label,
801
- how: entry.how,
802
- takenToBe: rolesOf(records.classified, entry.piece)
803
- }))
804
- });
805
- }
806
- })
807
- ];
808
- }
809
- /** For each piece of the card, the names of the characters, places and things the import made from it. */
810
- function entitiesByPiece(source) {
811
- const made = /* @__PURE__ */ new Map();
812
- for (const entity of source.records.roster ?? []) for (const entry of originOf(source.card, source.choices, source.pieces, source.records, entity.name)) made.set(entry.piece, [...made.get(entry.piece) ?? [], entity.name]);
813
- return made;
814
- }
815
- /** The pieces an entity was made from, as the build chose them: the ones the survey said are about it, then those that name it. */
816
- function originOf(card, choices, pieces, records, name) {
817
- if (records.roster === void 0 || records.classified === void 0) return [];
818
- const entity = findEntity(records.roster, name);
819
- if (entity === void 0) return [];
820
- const names = [entity.name, ...entity.aliases].map(norm);
821
- const items = itemise(card, choices);
822
- const chosen = sourcesFor(entity, items, records.classified);
823
- const about = (id) => (records.classified?.[id]?.targets ?? []).some((target) => target.kind === entity.kind && names.includes(norm(target.name)));
824
- const seen = /* @__PURE__ */ new Set();
825
- return chosen.flatMap((item) => {
826
- const id = baseId(item.id);
827
- const piece = pieces.find((entry) => entry.id === id);
828
- if (piece === void 0 || seen.has(id)) return [];
829
- seen.add(id);
830
- return [{
831
- piece: id,
832
- label: piece.label,
833
- how: about(item.id) ? "about it" : "mentions it"
834
- }];
835
- });
836
- }
837
- // src/host/import/card-diff.ts
838
- const MAX_SEGMENTS = 1500;
839
- const MAX_HUNK_CHARS = 700;
840
- /** Entries that kept neither their title nor their keys count as the same one only when this much of their words is shared. */
841
- const SAME_ENTRY = .5;
842
- const normalised = (text) => text.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim();
843
- const entryHead = (piece) => normalised([piece.title, ...piece.keys].join("|"));
844
- const words = (text) => new Set(text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? []);
845
- function overlap$1(a, b) {
846
- const first = words(a);
847
- const second = words(b);
848
- if (first.size === 0 && second.size === 0) return 1;
849
- let shared = 0;
850
- for (const word of first) if (second.has(word)) shared += 1;
851
- return shared / (first.size + second.size - shared);
852
- }
853
- /**
854
- * Which piece of the old card is which piece of the new one. Fields and greetings are the same by their id; lorebook entries are numbered by position, which an edit
855
- * shifts, so they are found by what they are called and keyed on, then by their text, and only then by the number.
856
- */
857
- function matchPieces(before, after) {
858
- const pairs = [];
859
- const left = new Map(before.map((piece) => [piece.id, piece]));
860
- const right = new Map(after.map((piece) => [piece.id, piece]));
861
- const pair = (a, b) => {
862
- pairs.push({
863
- before: a,
864
- after: b
865
- });
866
- left.delete(a.id);
867
- right.delete(b.id);
868
- };
869
- const isEntry = (piece) => piece.id.startsWith("entry:");
870
- for (const piece of before) {
871
- const other = right.get(piece.id);
872
- if (!isEntry(piece) && other !== void 0) pair(piece, other);
873
- }
874
- const unmatched = (map) => [...map.values()].filter(isEntry);
875
- for (const keyOf of [entryHead, (piece) => normalised(piece.text)]) {
876
- const taken = /* @__PURE__ */ new Set();
877
- for (const piece of unmatched(left)) {
878
- const key = keyOf(piece);
879
- if (key === "" || key === "|") continue;
880
- const candidates = unmatched(right).filter((other) => !taken.has(other.id) && keyOf(other) === key);
881
- const same = candidates.find((other) => other.id === piece.id) ?? candidates[0];
882
- if (same !== void 0) {
883
- taken.add(same.id);
884
- pair(piece, same);
885
- }
886
- }
887
- }
888
- for (const piece of unmatched(left)) {
889
- const other = right.get(piece.id);
890
- if (other !== void 0 && overlap$1(piece.text, other.text) >= SAME_ENTRY) pair(piece, other);
891
- }
892
- const order = new Map(before.map((piece, index) => [piece.id, index]));
893
- return {
894
- pairs: pairs.sort((a, b) => (order.get(a.before.id) ?? 0) - (order.get(b.before.id) ?? 0)),
895
- added: [...right.values()],
896
- removed: [...left.values()]
897
- };
898
- }
899
- /** The sentences and lines of a text, each with the whitespace that follows it, so that joining them gives the text back. */
900
- function segments(text) {
901
- const parts = [];
902
- const endings = ".!?。!?\n";
903
- let start = 0;
904
- let at = 0;
905
- while (at < text.length) {
906
- if (!endings.includes(text[at])) {
907
- at += 1;
908
- continue;
909
- }
910
- while (at < text.length && endings.includes(text[at])) at += 1;
911
- while (at < text.length && /\s/u.test(text[at])) at += 1;
912
- parts.push(text.slice(start, at));
913
- start = at;
914
- }
915
- if (start < text.length) parts.push(text.slice(start));
916
- return parts;
917
- }
918
- const shorten = (text) => {
919
- const clean = text.replace(/\s+/g, " ").trim();
920
- return clean.length <= MAX_HUNK_CHARS ? clean : `${clean.slice(0, MAX_HUNK_CHARS)}…`;
921
- };
922
- /** Where two versions of a text differ, sentence by sentence; nothing when they are the same, and undefined when the texts are too long to compare (read both then). */
923
- function diffText(before, after) {
924
- if (before === after) return [];
925
- const a = segments(before).map((part) => part.trim());
926
- const b = segments(after).map((part) => part.trim());
927
- if (a.length > MAX_SEGMENTS || b.length > MAX_SEGMENTS) return void 0;
928
- const width = b.length + 1;
929
- const table = new Uint16Array((a.length + 1) * width);
930
- for (let i = a.length - 1; i >= 0; i -= 1) for (let j = b.length - 1; j >= 0; j -= 1) table[i * width + j] = a[i] === b[j] ? table[(i + 1) * width + j + 1] + 1 : Math.max(table[(i + 1) * width + j], table[i * width + j + 1]);
931
- const hunks = [];
932
- let i = 0;
933
- let j = 0;
934
- let last;
935
- let removed = [];
936
- let added = [];
937
- let before_;
938
- const close = () => {
939
- if (removed.length + added.length === 0) return;
940
- hunks.push({
941
- ...before_ === void 0 ? {} : { after: shorten(before_) },
942
- removed: shorten(removed.join(" ")),
943
- added: shorten(added.join(" "))
944
- });
945
- removed = [];
946
- added = [];
947
- };
948
- while (i < a.length || j < b.length) {
949
- if (i < a.length && j < b.length && a[i] === b[j]) {
950
- close();
951
- last = a[i];
952
- before_ = last;
953
- i += 1;
954
- j += 1;
955
- continue;
956
- }
957
- if (removed.length + added.length === 0) before_ = last;
958
- if (j < b.length && (i === a.length || table[i * width + j + 1] >= table[(i + 1) * width + j])) {
959
- added.push(b[j]);
960
- j += 1;
961
- } else {
962
- removed.push(a[i]);
963
- i += 1;
964
- }
965
- }
966
- close();
967
- return hunks;
968
- }
969
- /** What differs in what the card says about itself rather than in its pieces. */
970
- function cardChanges(before, after) {
971
- const lines = [];
972
- const compare = (label, a, b) => {
973
- if (a !== b) lines.push(`${label}: “${shorten(a)}” → “${shorten(b)}”`);
974
- };
975
- compare("name", before.name, after.name);
976
- compare("creator", before.creator, after.creator);
977
- compare("version", before.characterVersion, after.characterVersion);
978
- compare("tags", before.tags.join(", "), after.tags.join(", "));
979
- return lines;
980
- }
981
- /** What the newer card changes that the world keeps in its own file (the fields edit_world_info sets) rather than in a character, place, thing or entry. */
982
- function worldFieldChanges(before, after) {
983
- const changes = [];
984
- const differ = (a, b) => a.trim() !== b.trim();
985
- if (differ(before.card.description, after.card.description) || differ(before.card.scenario, after.card.scenario) || differ(before.card.creatorNotes, after.card.creatorNotes)) changes.push({
986
- field: "description",
987
- because: "the card's description, scenario or creator's notes changed, and the world's description summarises them"
988
- });
989
- if (before.card.tags.join("\n") !== after.card.tags.join("\n")) changes.push({
990
- field: "tags",
991
- because: `the card\'s tags are now: ${after.card.tags.join(", ") || "(none)"}; the world\'s tags follow them, and you add none of your own`
992
- });
993
- if (differ(before.card.creator, after.card.creator)) changes.push({
994
- field: "authorName",
995
- because: `the card\'s creator is now “${after.card.creator}”`
996
- });
997
- if (differ(openingText(before.card, before.choices.opening) ?? "", openingText(after.card, after.choices.opening) ?? "")) changes.push({
998
- field: "opening",
999
- because: "the greeting the world opens with changed; suggested is the new greeting as the import writes an opening (plain paragraphs, the card's markup removed, the player named by the world's player character where the card says {{user}})",
1000
- suggested: openingMessage(openingText(after.card, after.choices.opening) ?? "", after.card.name)
1001
- });
1002
- if (JSON.stringify(alternateOpenings(before.card, before.choices.opening)) !== JSON.stringify(alternateOpenings(after.card, after.choices.opening))) changes.push({
1003
- field: "alternateOpenings",
1004
- because: "the card's other greetings changed; suggested is the whole list as the import writes it",
1005
- suggested: alternateOpenings(after.card, after.choices.opening)
1006
- });
1007
- return changes;
1008
- }
1009
467
  // src/host/import/update.ts
1010
468
  const PREVIOUS_FOLDER = "previous";
1011
469
  const CLASSIFICATION = "classification.json";
@@ -1048,7 +506,7 @@ async function findTargets(worlds, name) {
1048
506
  }
1049
507
  /** The message that sends the authoring chat to bring a world up to date with the newer card; it speaks the person's language, like the import command. */
1050
508
  function updateMessage(language) {
1051
- return translator(languageOf(language))("The character card this world was made from has a newer version, kept in this world's .import/update folder. Bring the world up to date with it. First call card_diff: it lists what changed between the two versions, which characters, places and things were made from each changed piece, and which files of the world have been edited since the import. Read the pieces you need with card_read (version current is the old card, version new is the new one). Then change only what the new card changed, with your editing tools, and keep what the person has edited since the import. What the card says about the world itself (its description, tags and opening) is changed with edit_world_info. Remove what only a dropped piece made unless the person edited it. Do not add what neither version of the card says. When the world matches the new card, call card_update_finish, then tell me briefly what you changed, what you left alone and why.");
509
+ return translator(languageOf(language))("The character card this world was made from has a newer version, kept in this world's .import/update folder. Bring the world up to date with it. First call card_diff: it lists what changed between the two versions, which characters, places and things were made from each changed piece, and which files of the world have been edited since the import. Read the pieces you need with card_read (version current is the old card, version new is the new one). Then change only what the new card changed, with your editing tools, and keep what the person has edited since the import. What the card says about the world itself (its description, tags and opening) is changed with edit_world_info. Remove what only a dropped piece made unless the person edited it. Do not add what neither version of the card says. When the world matches the new card, call check_card with version new: it lists what the new card changed that the world does not say yet; deal with each finding or say why you left it. Then call card_update_finish, and tell me briefly what you changed, what you left alone and why.");
1052
510
  }
1053
511
  /**
1054
512
  * Starts the update of a world from an uploaded card: the card waits in the world's import folder, the world's authoring chat is opened, and it is told to apply the difference.
@@ -1586,7 +1044,11 @@ async function readWorldDocuments(directory) {
1586
1044
  }
1587
1045
  // src/host/translate/translate-world.ts
1588
1046
  /** What is not carried over to a translation: the removed things of the editor and the card import's working files. */
1589
- const NOT_COPIED = /* @__PURE__ */ new Set([".trash", ".import"]);
1047
+ const NOT_COPIED = /* @__PURE__ */ new Set([
1048
+ ".trash",
1049
+ ".import",
1050
+ ".checks"
1051
+ ]);
1590
1052
  const TERMS_PER_JOB = 40;
1591
1053
  const TEXTS_PER_JOB = 30;
1592
1054
  const CHARS_PER_JOB = 5e3;
@@ -1870,121 +1332,6 @@ function translateTools(worlds, settings, prompting) {
1870
1332
  }
1871
1333
  })];
1872
1334
  }
1873
- // src/host/worlds/world-info.ts
1874
- const textOf$1 = (value) => typeof value === "string" ? value : "";
1875
- const toolsOf = (value) => {
1876
- const board = value === void 0 ? {} : parseSwitchboard(value, "tools");
1877
- return typeof board === "string" ? {} : board;
1878
- };
1879
- function infoOf(document) {
1880
- const opening = document["opening_message"];
1881
- const parts = Array.isArray(opening) && opening.some((part) => typeof part === "object" && part !== null && part["type"] === "utterance");
1882
- const plain = typeof opening === "string" ? opening : Array.isArray(opening) ? opening.map((part) => textOf$1(part?.["text"])).filter((text) => text !== "").join("\n\n") : "";
1883
- const metadata = typeof document["metadata"] === "object" && document["metadata"] !== null ? document["metadata"] : {};
1884
- const author = typeof document["author"] === "object" && document["author"] !== null ? document["author"] : {};
1885
- const rules = document["rules"];
1886
- return {
1887
- name: textOf$1(document["name"]),
1888
- description: textOf$1(document["description"]),
1889
- tags: Array.isArray(metadata["tags"]) ? metadata["tags"].filter((tag) => typeof tag === "string") : [],
1890
- rules: typeof rules === "string" ? [rules] : Array.isArray(rules) ? rules.filter((rule) => typeof rule === "string") : [],
1891
- opening: plain,
1892
- openingParts: parts,
1893
- authorName: textOf$1(author["name"]),
1894
- authorUrl: textOf$1(author["url"]),
1895
- timeZone: textOf$1(document["time_zone"]),
1896
- startingTime: textOf$1(document["starting_time"]),
1897
- preset: textOf$1(document["preset"]),
1898
- lorebooks: Array.isArray(document["lorebooks"]) ? document["lorebooks"].filter((name) => typeof name === "string") : [],
1899
- version: typeof document["version"] === "number" ? String(document["version"]) : textOf$1(document["version"]),
1900
- sampling: parseSampling(document["sampling"], "sampling", []),
1901
- tools: toolsOf(document["tools"]),
1902
- alternateOpenings: Array.isArray(document["alternate_openings"]) ? document["alternate_openings"].flatMap((entry) => typeof entry === "object" && entry !== null && typeof entry["text"] === "string" ? [{
1903
- title: textOf$1(entry["title"]),
1904
- text: entry["text"],
1905
- ...textOf$1(entry["character"]) === "" ? {} : { character: textOf$1(entry["character"]) }
1906
- }] : []) : []
1907
- };
1908
- }
1909
- async function readDocument(directory) {
1910
- const text = await readFile(join(directory, WORLD_FILE_NAME), "utf8");
1911
- return {
1912
- text,
1913
- document: JSON.parse(text.replace(/^/, ""))
1914
- };
1915
- }
1916
- async function readWorldInfo(directory) {
1917
- return infoOf((await readDocument(directory)).document);
1918
- }
1919
- function setOrRemove(document, key, value) {
1920
- if (value === "") delete document[key];
1921
- else document[key] = value;
1922
- }
1923
- /**
1924
- * Changes the fields of `world.json` the edit names and nothing else, keeping the file's other fields and its indentation. The result is read
1925
- * back as the world will be read before it is written.
1926
- * @throws {InvalidEditProblems} when the world would no longer be valid.
1927
- */
1928
- function editWorldInfo(directory, edit) {
1929
- return serialized(directory, () => changeWorldInfo(directory, edit));
1930
- }
1931
- async function changeWorldInfo(directory, edit) {
1932
- const { text, document } = await readDocument(directory);
1933
- const before = infoOf(document);
1934
- if (edit.opening !== void 0 && before.openingParts && edit.opening !== before.opening) throw new InvalidEditProblems(["the opening has lines spoken by characters: change it in the file, or ask the authoring assistant"]);
1935
- if (edit.name !== void 0) document["name"] = edit.name;
1936
- if (edit.description !== void 0) document["description"] = edit.description;
1937
- if (edit.tags !== void 0) document["metadata"] = {
1938
- ...typeof document["metadata"] === "object" && document["metadata"] !== null ? document["metadata"] : {},
1939
- tags: edit.tags
1940
- };
1941
- if (edit.rules !== void 0) {
1942
- if (edit.rules.length === 0) delete document["rules"];
1943
- else document["rules"] = edit.rules;
1944
- }
1945
- if (edit.opening !== void 0 && !before.openingParts) setOrRemove(document, "opening_message", edit.opening);
1946
- if (edit.authorName !== void 0 || edit.authorUrl !== void 0) {
1947
- const name = edit.authorName ?? before.authorName;
1948
- const url = edit.authorUrl ?? before.authorUrl;
1949
- if (name === "" && url !== "") throw new InvalidEditProblems(["an author link needs the author's name"]);
1950
- if (name === "") delete document["author"];
1951
- else document["author"] = {
1952
- ...typeof document["author"] === "object" && document["author"] !== null ? document["author"] : {},
1953
- name,
1954
- ...url === "" ? {} : { url }
1955
- };
1956
- if (url === "" && typeof document["author"] === "object") delete document["author"]["url"];
1957
- }
1958
- if (edit.timeZone !== void 0) setOrRemove(document, "time_zone", edit.timeZone);
1959
- if (edit.startingTime !== void 0) setOrRemove(document, "starting_time", edit.startingTime);
1960
- if (edit.version !== void 0) setOrRemove(document, "version", edit.version);
1961
- if (edit.preset !== void 0) setOrRemove(document, "preset", edit.preset);
1962
- if (edit.lorebooks !== void 0) {
1963
- if (edit.lorebooks.length === 0) delete document["lorebooks"];
1964
- else document["lorebooks"] = edit.lorebooks;
1965
- }
1966
- if (edit.alternateOpenings !== void 0) {
1967
- if (edit.alternateOpenings.length === 0) delete document["alternate_openings"];
1968
- else document["alternate_openings"] = edit.alternateOpenings.map((entry) => ({
1969
- title: entry.title === "" ? entry.text.slice(0, 40) : entry.title,
1970
- text: entry.text,
1971
- ...entry.character === void 0 || entry.character === "" ? {} : { character: entry.character }
1972
- }));
1973
- }
1974
- if (edit.sampling !== void 0) {
1975
- if (Object.keys(edit.sampling).length === 0) delete document["sampling"];
1976
- else document["sampling"] = edit.sampling;
1977
- }
1978
- if (edit.tools !== void 0) {
1979
- if (Object.keys(edit.tools).length === 0) delete document["tools"];
1980
- else document["tools"] = edit.tools;
1981
- }
1982
- const next = JSON.stringify(document, null, /^([ \t]+)"/m.exec(text)?.[1] ?? " ") + (text.endsWith("\n") ? "\n" : "");
1983
- const parsed = parseWorldFile(next);
1984
- if (!parsed.ok) throw new InvalidEditProblems(parsed.issues.map(formatIssue));
1985
- await atomicWrite(join(directory, WORLD_FILE_NAME), next);
1986
- return infoOf(document);
1987
- }
1988
1335
  // src/host/import/preset-tools.ts
1989
1336
  const PRESET_TOOL = "import_preset";
1990
1337
  const PRESET_FILE = "preset.json";
@@ -2043,34 +1390,6 @@ function presetTools(worlds, settings, prompting) {
2043
1390
  }
2044
1391
  })];
2045
1392
  }
2046
- // src/host/triggers/parts.ts
2047
- /** What the files of a world say it has, for checking what a trigger names. @throws {InvalidEditProblems} when those files have problems of their own: they are fixed first. */
2048
- async function loadWorldParts(directory) {
2049
- const { characters, problems: characterProblems } = await loadCharacters(directory);
2050
- const { locations, problems: locationProblems } = await loadLocations(directory);
2051
- const { items, slots, problems: itemProblems } = await loadItems(directory, {
2052
- characters: characters.map((character) => character.id),
2053
- locations
2054
- });
2055
- const { defs, problems: variableProblems } = await loadVariables(directory);
2056
- const { calendar, problems: calendarProblems } = await loadCalendar(directory);
2057
- const problems = [
2058
- ...characterProblems,
2059
- ...locationProblems,
2060
- ...itemProblems,
2061
- ...variableProblems,
2062
- ...calendarProblems
2063
- ];
2064
- if (problems.length > 0) throw new InvalidEditProblems([`the world's other files have problems that come first: ${problems.map((problem) => `${problem.path}: ${problem.message}`).join("; ")}`]);
2065
- return {
2066
- characters,
2067
- locations,
2068
- items,
2069
- slots,
2070
- variables: defs,
2071
- calendar
2072
- };
2073
- }
2074
1393
  // src/host/triggers/check.ts
2075
1394
  /**
2076
1395
  * What each trigger names that the world does not have (a character, place, item or variable in its condition, its cues or the words of a
@@ -2080,34 +1399,13 @@ async function loadWorldParts(directory) {
2080
1399
  function triggerProblemsOf(parts, definitions) {
2081
1400
  const found = /* @__PURE__ */ new Map();
2082
1401
  if (definitions.length === 0) return found;
2083
- const scratch = createSessionStore(":memory:", {
2084
- id: "scratch",
2085
- name: "scratch",
2086
- world: {
2087
- id: "scratch",
2088
- name: "scratch"
2089
- }
2090
- }, { vectors: false });
2091
- try {
2092
- const session = scratch;
2093
- if (parts.calendar !== void 0) writeCalendar(scratch.metadata, parts.calendar);
2094
- populateLocations(session, parts.locations);
2095
- populateCharacters(session, parts.characters, parts.characters.find((character) => character.role === "playable")?.id ?? "");
2096
- populateItems(session, parts.items, parts.slots, parts.locations);
2097
- populateVariables(session, parts.variables, {
2098
- characters: parts.characters,
2099
- items: parts.items,
2100
- locations: parts.locations,
2101
- values: void 0
2102
- });
1402
+ withScratchStory(parts, (story) => {
2103
1403
  const keys = definitions.map((definition) => definition.key);
2104
1404
  for (const definition of definitions) {
2105
- const problems = triggerReferenceProblems(scratch, definition, keys).map((problem) => problem.slice(definition.key.length + 2));
1405
+ const problems = triggerReferenceProblems(story, definition, keys).map((problem) => problem.slice(definition.key.length + 2));
2106
1406
  if (problems.length > 0) found.set(definition.key, problems);
2107
1407
  }
2108
- } finally {
2109
- scratch.close();
2110
- }
1408
+ });
2111
1409
  return found;
2112
1410
  }
2113
1411
  // src/host/triggers/files.ts
@@ -3339,6 +2637,6 @@ async function packJail(exec, next, deps) {
3339
2637
  function registerPackJail(ctx, deps) {
3340
2638
  ctx.on("tools/pre-execute", (exec, next) => packJail(exec, next, deps), { prepend: true });
3341
2639
  }
3342
- export { matchPieces as $, worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, loadWorldParts as F, findTargets as G, translateTools as H, PRESET_FILE as I, revertUpdate as J, finishUpdate as K, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, diffText as Q, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, updateStatus as X, startUpdate as Y, cardChanges as Z, editWorldPlots as _, deleteWorldPackFile as a, authoringTitle as at, entityFolder as b, createAuthoredEntity as c, agentServicesOf as ct, replaceAuthoredEntity as d, appendNarratedTurn as dt, worldFieldChanges as et, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, AuthoringSessions as it, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, DOCTOR_OPENING_SOURCE as lt, editWorldLore as m, packFileProblem as n, entitiesByPiece as nt, listWorldPacks as o, ensureAuthoringChat as ot, editWorldFaction as p, pendingUpdate as q, registerPackJail as r, readSource as rt, AUTHORED_ENTITY_KINDS as s, AgentSessions as st, MAX_PACK_TEXT as t, cardTools as tt, readAuthoredEntityDocument as u, appendEmptyTurn as ut, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
2640
+ export { DOCTOR_OPENING_SOURCE as $, worldEntityImageFile as A, languageOfDocuments as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, PRESET_FILE as F, revertUpdate as G, findTargets as H, presetMessage as I, AuthoringSessions as J, startUpdate as K, presetTools as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, agentServicesOf as Q, translateMessage as R, generateWorldEntityImage as S, removeWorldTrigger as T, finishUpdate as U, readWorldDocuments as V, pendingUpdate as W, ensureAuthoringChat as X, authoringTitle as Y, AgentSessions as Z, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, appendEmptyTurn as et, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, editWorldLore as m, packFileProblem as n, listWorldPacks as o, editWorldFaction as p, updateStatus as q, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, appendNarratedTurn as tt, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, translateTools as z };
3343
2641
 
3344
- //# sourceMappingURL=pack-jail-CN-314ln.js.map
2642
+ //# sourceMappingURL=pack-jail-BMy6NcCY.js.map