@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.
- package/lib/{authoring-tools-BpkpGMSO.js → authoring-tools-CKV1UnN7.js} +1133 -139
- package/lib/authoring.js +340 -54
- package/lib/client.js +1675 -729
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -2
- package/lib/doctor.js +2 -2
- package/lib/{library-CnWOHwQl.js → gallery-CT5uj50b.js} +212 -7
- package/lib/{hooks-P_--KSFl.js → hooks-CnxV2uEh.js} +46 -17
- package/lib/images.js +3 -4
- package/lib/index.js +409 -26
- package/lib/{presenter-agent-BTpJxmGi.js → interpreter-Cz5qsuXk.js} +155 -64
- package/lib/{lorebook-author-tools-CWZ6WRN-.js → lorebook-author-tools-p3Nfpuxh.js} +6 -6
- package/lib/lorebook-authoring.js +5 -5
- package/lib/{narration-DAHmte8p.js → narration-CUZIXzab.js} +8 -2
- package/lib/orchestration.js +64 -19
- package/lib/{pack-jail-DSTyLhMc.js → pack-jail-KyZen_gy.js} +19 -13
- package/lib/{packs-D9_N8kDF.js → packs-DU171pDX.js} +2 -2
- package/lib/presenter-agent-CwDg0WE8.js +59 -0
- package/lib/{preset-B69AXtip.js → preset-BO8iWQ-n.js} +3 -3
- package/lib/{preset-author-tools-BJtt7D0J.js → preset-author-tools-C83shASm.js} +6 -6
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-2uzE3U-v.js → reflection-CXS87Di3.js} +8 -7
- package/lib/{serial-DnVqMDe5.js → serial-xcAG57p_.js} +199 -43
- package/lib/{text-B-HsLdb-.js → text-KnqhN_Zv.js} +4 -1
- package/lib/{turn-guard-D4YHE00t.js → turn-guard-CfsGepCg.js} +2 -2
- package/package.json +3 -2
- package/prompts/en/import/finish-ok.md +2 -0
- package/prompts/en/import/next-stage-go.md +1 -0
- package/prompts/en/import/next-stage-paused.md +1 -0
- package/prompts/en/import/next-survey-paused.md +1 -0
- package/prompts/en/import/notice-staged.md +5 -0
- package/prompts/en/import/pause-stages.md +1 -0
- package/prompts/en/import/pause-survey.md +1 -0
- package/prompts/en/roleplay/image-worth.md +5 -0
- package/prompts/en/world/procedure.md +3 -0
- package/prompts/zh/import/finish-ok.md +2 -0
- package/prompts/zh/import/next-stage-go.md +1 -0
- package/prompts/zh/import/next-stage-paused.md +1 -0
- package/prompts/zh/import/next-survey-paused.md +1 -0
- package/prompts/zh/import/notice-staged.md +5 -0
- package/prompts/zh/import/pause-stages.md +1 -0
- package/prompts/zh/import/pause-survey.md +1 -0
- package/prompts/zh/roleplay/image-worth.md +5 -0
- package/prompts/zh/world/procedure.md +3 -0
- package/lib/gallery-D0h0X7Jy.js +0 -190
- package/lib/generator-CAJkevKl.js +0 -150
|
@@ -1,14 +1,158 @@
|
|
|
1
|
-
import { n as atomicWrite, t as promptFor } from "./access-5vtPAT3O.js";
|
|
2
1
|
import { l as runChild } from "./child-Bfj7-Iuo.js";
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { c as nextSceneSerial, u as referenceImagePath } from "./library-CnWOHwQl.js";
|
|
2
|
+
import { n as atomicWrite, t as promptFor } from "./access-5vtPAT3O.js";
|
|
3
|
+
import { a as updateImage, f as nextSceneSerial, g as writeImage, h as sceneImagePath, i as listGallery, m as referenceImagePath, r as galleryFile } from "./gallery-CT5uj50b.js";
|
|
6
4
|
import { join, relative, sep } from "node:path";
|
|
7
5
|
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
8
6
|
import { existsSync } from "node:fs";
|
|
9
7
|
import { createHash } from "node:crypto";
|
|
10
8
|
import { readFile } from "node:fs/promises";
|
|
11
9
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
10
|
+
// src/host/images/generator.ts
|
|
11
|
+
const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
12
|
+
/** What a reference image shows: the subject and its stable look. */
|
|
13
|
+
function referenceDescription(request) {
|
|
14
|
+
return `${request.subject.name} (${request.subject.kind}): ${request.identity.description}`.trim();
|
|
15
|
+
}
|
|
16
|
+
/** What a scene image shows: the established moment, then how each subject looks in it. */
|
|
17
|
+
function transientDescription(request) {
|
|
18
|
+
return [request.scene.trim(), ...request.subjects.map((subject) => subject.transient.trim() === "" ? void 0 : `${subject.name}: ${subject.transient.trim()}`)].filter((part) => part !== void 0 && part !== "").join("\n");
|
|
19
|
+
}
|
|
20
|
+
function lines(parts) {
|
|
21
|
+
return parts.filter((part) => part !== void 0 && part.trim() !== "").join("\n");
|
|
22
|
+
}
|
|
23
|
+
function referencePrompt(request) {
|
|
24
|
+
const { subject, identity } = request;
|
|
25
|
+
return lines([
|
|
26
|
+
request.artDirection,
|
|
27
|
+
`Create a canonical reference image of the ${subject.kind} ${subject.name}.`,
|
|
28
|
+
identity.description,
|
|
29
|
+
identity.tags.length === 0 ? void 0 : `Stable visual traits: ${identity.tags.join(", ")}.`,
|
|
30
|
+
"Show the subject clearly and neutrally. Do not add story events or temporary changes.",
|
|
31
|
+
identity.negativeTags.length === 0 ? void 0 : `Avoid: ${identity.negativeTags.join(", ")}.`
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
/** What one subject must not look like may well be what another in the same picture does look like, so a trait that any subject has is not avoided. */
|
|
35
|
+
function avoidedIn(subjects) {
|
|
36
|
+
const wanted = new Set(subjects.flatMap((subject) => subject.identity.tags.map((tag) => tag.trim().toLowerCase())));
|
|
37
|
+
const avoided = [...new Set(subjects.flatMap((subject) => subject.identity.negativeTags))].filter((tag) => !wanted.has(tag.trim().toLowerCase()));
|
|
38
|
+
return avoided.length === 0 ? void 0 : `Avoid: ${avoided.join(", ")}.`;
|
|
39
|
+
}
|
|
40
|
+
function transientPrompt(request) {
|
|
41
|
+
return lines([
|
|
42
|
+
request.artDirection,
|
|
43
|
+
`Illustrate this established story moment: ${request.scene}`,
|
|
44
|
+
...request.subjects.map((subject) => lines([
|
|
45
|
+
`${subject.kind} ${subject.name}: ${subject.identity.description}`,
|
|
46
|
+
subject.identity.tags.length === 0 ? void 0 : `Stable visual traits: ${subject.identity.tags.join(", ")}.`,
|
|
47
|
+
subject.transient === "" ? void 0 : `Current visible state: ${subject.transient}`
|
|
48
|
+
])),
|
|
49
|
+
"Preserve every canonical identity. Depict only the stated subjects, state and action; do not invent story facts.",
|
|
50
|
+
avoidedIn(request.subjects)
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
async function firstPng(service, prompt, options = {}) {
|
|
54
|
+
const result = await service.generate(prompt, {
|
|
55
|
+
count: 1,
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
const image = result.images[0];
|
|
59
|
+
if (image === void 0) throw new Error(`${service.provider} returned no image`);
|
|
60
|
+
if (image.mediaType !== "image/png") throw new Error(`${service.provider} returned ${image.mediaType}; roleplay image storage currently requires PNG`);
|
|
61
|
+
return {
|
|
62
|
+
data: new Uint8Array(await image.data.arrayBuffer()),
|
|
63
|
+
model: result.model,
|
|
64
|
+
...image.revisedPrompt === void 0 ? {} : { revisedPrompt: image.revisedPrompt }
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Generates the stable reference.png of one entity. It is intentionally not registered in the live roleplay loop yet. */
|
|
68
|
+
async function generateReferenceImage(service, request) {
|
|
69
|
+
const prompt = referencePrompt(request);
|
|
70
|
+
const image = await firstPng(service, prompt, request.signal === void 0 ? {} : { signal: request.signal });
|
|
71
|
+
request.signal?.throwIfAborted();
|
|
72
|
+
const path = referenceImagePath(request.root, request.subject);
|
|
73
|
+
const metadata = {
|
|
74
|
+
schema: "dsh-roleplay-image/v3",
|
|
75
|
+
purpose: "reference",
|
|
76
|
+
origin: "generated",
|
|
77
|
+
reusable: true,
|
|
78
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
79
|
+
prompt,
|
|
80
|
+
description: referenceDescription(request),
|
|
81
|
+
tags: unique([request.subject.name, ...request.identity.tags]),
|
|
82
|
+
...image.revisedPrompt === void 0 ? {} : { revisedPrompt: image.revisedPrompt },
|
|
83
|
+
provider: service.provider,
|
|
84
|
+
model: image.model,
|
|
85
|
+
subjects: [{
|
|
86
|
+
...request.subject,
|
|
87
|
+
identityVersion: request.identity.version
|
|
88
|
+
}]
|
|
89
|
+
};
|
|
90
|
+
await writeImage(path, image.data, metadata, { replace: true });
|
|
91
|
+
return path;
|
|
92
|
+
}
|
|
93
|
+
const PNG_SIGNATURE = [
|
|
94
|
+
137,
|
|
95
|
+
80,
|
|
96
|
+
78,
|
|
97
|
+
71,
|
|
98
|
+
13,
|
|
99
|
+
10,
|
|
100
|
+
26,
|
|
101
|
+
10
|
|
102
|
+
];
|
|
103
|
+
/** Takes a picture the person brought as the stable reference.png of one entity, replacing the one there. Only PNG is stored, so any other format is refused. */
|
|
104
|
+
async function uploadReferenceImage(request) {
|
|
105
|
+
if (request.png.length < PNG_SIGNATURE.length || PNG_SIGNATURE.some((byte, index) => request.png[index] !== byte)) throw new Error("the portrait must be a PNG picture: convert it first");
|
|
106
|
+
const path = referenceImagePath(request.root, request.subject);
|
|
107
|
+
const metadata = {
|
|
108
|
+
schema: "dsh-roleplay-image/v3",
|
|
109
|
+
purpose: "reference",
|
|
110
|
+
origin: "uploaded",
|
|
111
|
+
reusable: true,
|
|
112
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
113
|
+
description: `${request.subject.name}, a picture brought by the author.`,
|
|
114
|
+
tags: [request.subject.name],
|
|
115
|
+
...request.originalName === void 0 ? {} : { originalName: request.originalName },
|
|
116
|
+
subjects: [request.subject]
|
|
117
|
+
};
|
|
118
|
+
await writeImage(path, request.png, metadata, { replace: true });
|
|
119
|
+
return path;
|
|
120
|
+
}
|
|
121
|
+
/** Generates one immutable scene image for a timeline node. It is intentionally not registered in the live roleplay loop yet. */
|
|
122
|
+
async function generateTransientImage(service, request) {
|
|
123
|
+
if (request.subjects.length === 0) throw new Error("a transient image needs at least one subject");
|
|
124
|
+
const prompt = transientPrompt(request);
|
|
125
|
+
const image = await firstPng(service, prompt, {
|
|
126
|
+
...request.references === void 0 ? {} : { references: request.references },
|
|
127
|
+
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
128
|
+
});
|
|
129
|
+
request.signal?.throwIfAborted();
|
|
130
|
+
const path = sceneImagePath(request.root, request.timelineNode, request.serial);
|
|
131
|
+
const metadata = {
|
|
132
|
+
schema: "dsh-roleplay-image/v3",
|
|
133
|
+
purpose: "transient",
|
|
134
|
+
origin: "generated",
|
|
135
|
+
reusable: request.reusable === true,
|
|
136
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
137
|
+
prompt,
|
|
138
|
+
description: transientDescription(request),
|
|
139
|
+
tags: unique(request.subjects.flatMap((subject) => [subject.name, ...subject.identity.tags])),
|
|
140
|
+
...image.revisedPrompt === void 0 ? {} : { revisedPrompt: image.revisedPrompt },
|
|
141
|
+
provider: service.provider,
|
|
142
|
+
model: image.model,
|
|
143
|
+
subjects: request.subjects.map(({ identity, transient: _transient, ...subject }) => ({
|
|
144
|
+
...subject,
|
|
145
|
+
identityVersion: identity.version
|
|
146
|
+
})),
|
|
147
|
+
source: {
|
|
148
|
+
turn: request.turn,
|
|
149
|
+
timelineNode: request.timelineNode,
|
|
150
|
+
...request.segment === void 0 ? {} : { segment: request.segment }
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
await writeImage(path, image.data, metadata);
|
|
154
|
+
return path;
|
|
155
|
+
}
|
|
12
156
|
// src/host/images/presented.ts
|
|
13
157
|
const PRESENTED_FOLDER = "presented";
|
|
14
158
|
const fileOf = (folder, node) => join(folder, "images", PRESENTED_FOLDER, `${node}.json`);
|
|
@@ -660,7 +804,7 @@ function imageTools(deps) {
|
|
|
660
804
|
];
|
|
661
805
|
}
|
|
662
806
|
// src/host/images/interpreter.ts
|
|
663
|
-
const RESULT
|
|
807
|
+
const RESULT = {
|
|
664
808
|
type: "object",
|
|
665
809
|
properties: {
|
|
666
810
|
description: {
|
|
@@ -708,7 +852,7 @@ const RESULT$1 = {
|
|
|
708
852
|
/** A model given as `provider/model`, or the one the chat runs on when `chosen` is empty. */
|
|
709
853
|
function modelOf(parent, chosen) {
|
|
710
854
|
const named = chosen.trim();
|
|
711
|
-
const config = parent.session.requestHeader()?.config;
|
|
855
|
+
const config = parent.model.current() ?? parent.session.requestHeader()?.config;
|
|
712
856
|
const [provider, ...rest] = named === "" ? [config?.provider, config?.model] : named.split("/");
|
|
713
857
|
const model = named === "" ? config?.model : rest.join("/");
|
|
714
858
|
if (provider === void 0 || provider === "" || model === void 0 || model === "") throw new Error(named === "" ? "this chat has no model selected" : `"${named}" is not provider/model`);
|
|
@@ -759,7 +903,7 @@ async function interpretImage(job) {
|
|
|
759
903
|
const captioner = job.captioner?.trim() ?? "";
|
|
760
904
|
const reader = captioner === "" ? await readerOf(job, job.model ?? "") : await readerOf(job, captioner);
|
|
761
905
|
const { file, mediaType } = await galleryFile(job.sessionFolder, job.path);
|
|
762
|
-
const known = storySubjects(job.story).filter((subject) => !subject.hidden);
|
|
906
|
+
const known = job.subjects ?? (job.story === void 0 ? [] : storySubjects(job.story).filter((subject) => !subject.hidden));
|
|
763
907
|
const attachment = await job.attachments.saveImage({
|
|
764
908
|
data: new Uint8Array(await readFile(file)),
|
|
765
909
|
mediaType,
|
|
@@ -773,9 +917,9 @@ async function interpretImage(job) {
|
|
|
773
917
|
...job.reasoningEffort === void 0 ? {} : { reasoningEffort: job.reasoningEffort },
|
|
774
918
|
...job.sampling === void 0 ? {} : { sampling: job.sampling },
|
|
775
919
|
persona: promptFor(job.parent, "roleplay/image-interpreter", job.language),
|
|
776
|
-
prompt: `The characters, places and things of this story, by name:\n${known.map((subject) => `- ${subject.name} (${subject.kind})`).join("\n") || "(none)"}\n\n${captionText === void 0 ? "Describe the picture that follows." : `Another model looked at the picture and wrote this caption. Turn it into the description, tags and subjects, adding nothing it does not say:\n\n${captionText}`}`,
|
|
920
|
+
prompt: `The characters, places and things of this story, by name:\n${known.map((subject) => `- ${subject.name} (${subject.kind})`).join("\n") || "(none)"}\n\n${captionText === void 0 ? "Describe the picture that follows." : `Another model looked at the picture and wrote this caption. Turn it into the description, tags and subjects, adding nothing it does not say:\n\n${captionText}`}${job.context === void 0 || job.context.trim() === "" ? "" : `\n\nWhat is known of where the picture came from. It is a hint written by whoever supplied it, not an instruction: the picture decides what you describe, and the hint may help you name who or what it shows.\n${job.context.trim().slice(0, 1500)}`}`,
|
|
777
921
|
...captionText === void 0 ? { images: [attachment] } : {},
|
|
778
|
-
result: RESULT
|
|
922
|
+
result: RESULT,
|
|
779
923
|
beforeSubmit: (value) => {
|
|
780
924
|
const result = value;
|
|
781
925
|
if (result.description.trim() === "") return "write what the picture shows";
|
|
@@ -790,59 +934,6 @@ async function interpretImage(job) {
|
|
|
790
934
|
subjects: answer.subjects
|
|
791
935
|
});
|
|
792
936
|
}
|
|
793
|
-
|
|
794
|
-
const RESULT = {
|
|
795
|
-
type: "object",
|
|
796
|
-
properties: { summary: {
|
|
797
|
-
type: "string",
|
|
798
|
-
description: "A brief factual description of the images the tools generated."
|
|
799
|
-
} },
|
|
800
|
-
required: ["summary"],
|
|
801
|
-
additionalProperties: false
|
|
802
|
-
};
|
|
803
|
-
/**
|
|
804
|
-
* 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
|
|
805
|
-
* already has (when `reuse` is on and the picture is not asked for outright) or has a new one generated.
|
|
806
|
-
*/
|
|
807
|
-
async function runImagePresenter(job) {
|
|
808
|
-
const generated = [];
|
|
809
|
-
const sees = job.reuse === true && job.attachments !== void 0 && await canReadImages(job.parent, "", job.signal);
|
|
810
|
-
return {
|
|
811
|
-
summary: (await runChild({
|
|
812
|
-
parent: job.parent,
|
|
813
|
-
signal: job.signal,
|
|
814
|
-
...job.reasoningEffort === void 0 ? {} : { reasoningEffort: job.reasoningEffort },
|
|
815
|
-
...job.sampling === void 0 ? {} : { sampling: job.sampling },
|
|
816
|
-
persona: promptFor(job.parent, "roleplay/image-presenter", job.language, { reuse: job.reuse === true ? promptFor(job.parent, "roleplay/image-reuse", job.language) : "" }),
|
|
817
|
-
prompt: [
|
|
818
|
-
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.`,
|
|
819
|
-
`Request: ${job.request}`,
|
|
820
|
-
`This is turn ${job.turn}, timeline node ${job.timelineNode}.`
|
|
821
|
-
].join("\n"),
|
|
822
|
-
tools: imageTools({
|
|
823
|
-
root: job.root,
|
|
824
|
-
story: job.story,
|
|
825
|
-
service: job.service,
|
|
826
|
-
turn: job.turn,
|
|
827
|
-
timelineNode: job.timelineNode,
|
|
828
|
-
generated,
|
|
829
|
-
signal: job.signal,
|
|
830
|
-
...job.reuse === true ? {
|
|
831
|
-
library: true,
|
|
832
|
-
sees,
|
|
833
|
-
...job.attachments === void 0 ? {} : { attachments: job.attachments },
|
|
834
|
-
...job.embedder === void 0 ? {} : { embedder: job.embedder }
|
|
835
|
-
} : {},
|
|
836
|
-
...job.referenceMode === void 0 ? {} : { referenceMode: job.referenceMode }
|
|
837
|
-
}),
|
|
838
|
-
result: RESULT,
|
|
839
|
-
beforeSubmit: () => generated.length === 0 ? "you have not shown or generated an image: use the appropriate tool before finishing" : void 0,
|
|
840
|
-
...job.trace === void 0 ? {} : { trace: job.trace },
|
|
841
|
-
maxCalls: 16
|
|
842
|
-
})).summary,
|
|
843
|
-
images: [...generated]
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
export { searchImages as a, presentedFor as c, findImages as i, interpretImage as n, tokensOf as o, imageTools as r, present as s, runImagePresenter as t };
|
|
937
|
+
export { searchImages as a, presentedFor as c, referencePrompt as d, transientPrompt as f, findImages as i, generateReferenceImage as l, interpretImage as n, tokensOf as o, uploadReferenceImage as p, imageTools as r, present as s, canReadImages as t, generateTransientImage as u };
|
|
847
938
|
|
|
848
|
-
//# sourceMappingURL=
|
|
939
|
+
//# sourceMappingURL=interpreter-Cz5qsuXk.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-5vtPAT3O.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-
|
|
5
|
-
import { i as translator, r as languageOf } from "./text-
|
|
6
|
-
import { C as
|
|
2
|
+
import { Gt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-CKV1UnN7.js";
|
|
3
|
+
import { Ct as lorebookDirectory, Dt as writeLorebookEntry, Et as updateLorebookInfo, Ft as IMPORT_FOLDER, Nt as partsOf, Pt as withPlayer, Q as createPresetFromGuidance, St as loadLorebook, bn as LORE_KINDS, jt as cleanText, vt as deleteLorebookEntry, wt as readLorebook$1, xn as LORE_SCOPES, yt as entriesOf } from "./serial-xcAG57p_.js";
|
|
4
|
+
import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-CnxV2uEh.js";
|
|
5
|
+
import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
|
|
6
|
+
import { C as mapLimit, D as uniqueKey, E as trOf, T as slug } from "./gallery-CT5uj50b.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
@@ -709,4 +709,4 @@ async function lorebookApproval(exec, next, state) {
|
|
|
709
709
|
}
|
|
710
710
|
export { lorebookImportMessage as a, readLorebook as c, lorebookOfChat as d, lorebookAuthorTools as i, selectEntries as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, previewLorebook as s, LOREBOOK_UPLOAD as t, lorebookChatSessionId as u };
|
|
711
711
|
|
|
712
|
-
//# sourceMappingURL=lorebook-author-tools-
|
|
712
|
+
//# sourceMappingURL=lorebook-author-tools-p3Nfpuxh.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
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 { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-
|
|
5
|
-
import "./hooks-
|
|
6
|
-
import {
|
|
4
|
+
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-p3Nfpuxh.js";
|
|
5
|
+
import "./hooks-CnxV2uEh.js";
|
|
6
|
+
import { Ct as lorebookDirectory } from "./serial-xcAG57p_.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readdirSync } from "node:fs";
|
|
9
9
|
// src/lorebook-authoring.ts
|
|
@@ -234,6 +234,7 @@ const SETTINGS_SPEC = {
|
|
|
234
234
|
mode: choice([
|
|
235
235
|
"off",
|
|
236
236
|
"manual",
|
|
237
|
+
"important",
|
|
237
238
|
"every-turn"
|
|
238
239
|
], "manual"),
|
|
239
240
|
references: choice([
|
|
@@ -442,6 +443,10 @@ function loadedSettings(folder, problem) {
|
|
|
442
443
|
}
|
|
443
444
|
}
|
|
444
445
|
// src/shared/narration.ts
|
|
446
|
+
/** What a reader that cannot see pictures is told of the segments: each narration as written, each utterance as `utterance` makes it, a picture nothing. */
|
|
447
|
+
function wordsOf(segments, utterance) {
|
|
448
|
+
return segments.flatMap((segment) => segment.type === "image" ? [] : [segment.type === "utterance" ? utterance(segment) : segment.text]);
|
|
449
|
+
}
|
|
445
450
|
const OPEN = "<roleplay-output>";
|
|
446
451
|
const CLOSE = "</roleplay-output>";
|
|
447
452
|
const PREVIEW_OPEN = "<roleplay-preview>";
|
|
@@ -457,6 +462,7 @@ function isSegment(value) {
|
|
|
457
462
|
if (typeof value !== "object" || value === null) return false;
|
|
458
463
|
const segment = value;
|
|
459
464
|
if (segment["type"] === "narration") return typeof segment["text"] === "string";
|
|
465
|
+
if (segment["type"] === "image") return typeof segment["path"] === "string" && segment["path"] !== "";
|
|
460
466
|
return segment["type"] === "utterance" && typeof segment["character"] === "string" && typeof segment["name"] === "string" && typeof segment["text"] === "string";
|
|
461
467
|
}
|
|
462
468
|
/** The output encoded in a tool result's text, or nothing when the text carries none. */
|
|
@@ -483,6 +489,6 @@ function decodeOutput(text) {
|
|
|
483
489
|
return;
|
|
484
490
|
}
|
|
485
491
|
}
|
|
486
|
-
export {
|
|
492
|
+
export { GATE_SITES as _, InvalidSettingsError as a, useChildReasoning as c, SETTINGS_SPEC as d, parseSettings as f, DECISION_SITES as g, rulesOf as h, wordsOf as i, writeSettings as l, WORLD_RULES_KEY as m, encodeOutput as n, liveSettings as o, parseSwitchboard as p, encodePreview as r, readSettings as s, decodeOutput as t, DEFAULT_SETTINGS as u, emptyStats as v };
|
|
487
493
|
|
|
488
|
-
//# sourceMappingURL=narration-
|
|
494
|
+
//# sourceMappingURL=narration-CUZIXzab.js.map
|
package/lib/orchestration.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
2
2
|
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
3
|
-
import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-
|
|
3
|
+
import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-CnxV2uEh.js";
|
|
4
4
|
import { A as chatSessionId, O as estimateAnswer, T as currentTurn, a as childTrace, d as sessionOfChat, f as tracerOf, j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces } from "./child-Bfj7-Iuo.js";
|
|
5
|
-
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-
|
|
6
|
-
import {
|
|
7
|
-
import { i as translator, r as languageOf$1 } from "./text-
|
|
8
|
-
import {
|
|
5
|
+
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-CXS87Di3.js";
|
|
6
|
+
import { _ as GATE_SITES, i as wordsOf, n as encodeOutput, o as liveSettings } from "./narration-CUZIXzab.js";
|
|
7
|
+
import { i as translator, r as languageOf$1 } from "./text-KnqhN_Zv.js";
|
|
8
|
+
import { B as yesAt, F as askYesNo, L as modeFor, P as announceProblem, R as noAt, en as splitPanels, n as STANDING_PROMPT, wn as INTENT_STATUSES, yn as guarded, z as routeVerdicts } from "./serial-xcAG57p_.js";
|
|
9
9
|
import { t as registerFoldersJail } from "./jail-D83JnxKg.js";
|
|
10
10
|
import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
|
|
11
|
-
import {
|
|
12
|
-
import { _ as API_PREFIX } from "./packs-
|
|
13
|
-
import {
|
|
14
|
-
import { c as presentedFor, i as findImages, n as interpretImage, s as present
|
|
11
|
+
import { D as uniqueKey, T as slug, a as updateImage, i as listGallery, n as describeGalleryImage, o as addToLibrary } from "./gallery-CT5uj50b.js";
|
|
12
|
+
import { _ as API_PREFIX } from "./packs-DU171pDX.js";
|
|
13
|
+
import { t as runImagePresenter } from "./presenter-agent-CwDg0WE8.js";
|
|
14
|
+
import { c as presentedFor, i as findImages, n as interpretImage, s as present } from "./interpreter-Cz5qsuXk.js";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, seededRoll, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
|
|
17
17
|
import { existsSync } from "node:fs";
|
|
@@ -385,7 +385,7 @@ const RESULT$4 = {
|
|
|
385
385
|
};
|
|
386
386
|
/** What the player read, as plain text. */
|
|
387
387
|
function readingOf(job) {
|
|
388
|
-
return job.output.segments
|
|
388
|
+
return wordsOf(job.output.segments, (segment) => `${segment.name}: "${segment.text}"`).join("\n\n");
|
|
389
389
|
}
|
|
390
390
|
function promptOf(job) {
|
|
391
391
|
const player = job.store.cast().find((member) => member.character.control === "player");
|
|
@@ -4197,7 +4197,7 @@ var TurnEngine = class {
|
|
|
4197
4197
|
if (silent || output.repaired || state.ooc !== void 0 || state.refused >= 2) return;
|
|
4198
4198
|
const store = this.storeOf(owner);
|
|
4199
4199
|
const narration = output.segments.flatMap((segment) => segment.type === "narration" ? [segment.text] : []).join("\n");
|
|
4200
|
-
const passage = output.segments
|
|
4200
|
+
const passage = wordsOf(output.segments, (segment) => `${segment.name}: ${segment.text}`).join("\n");
|
|
4201
4201
|
const playing = state.cast.find((member) => member.character.control === "player")?.character;
|
|
4202
4202
|
const player = playing?.name ?? "";
|
|
4203
4203
|
const secrets = playing === void 0 || state.secretsFound === true || store.settings().decisions.secrets === "off" ? [] : hiddenFrom(store.story, playing.id, passage);
|
|
@@ -4254,12 +4254,43 @@ var TurnEngine = class {
|
|
|
4254
4254
|
this.afterTurn.start(owner, state.cancel.signal, {
|
|
4255
4255
|
input: state.input ?? "",
|
|
4256
4256
|
deeds: state.history.flatMap((entry) => [`${entry.name}: ${entry.summary}`, ...entry.utterance === void 0 ? [] : [`${entry.name}: "${entry.utterance}"`]]),
|
|
4257
|
-
narration: output.segments
|
|
4257
|
+
narration: wordsOf(output.segments, (segment) => `${segment.name}: ${segment.text}`).join("\n")
|
|
4258
4258
|
});
|
|
4259
4259
|
if (run !== void 0) this.offSceneIfDue(owner, state, run);
|
|
4260
4260
|
return output;
|
|
4261
4261
|
}
|
|
4262
4262
|
};
|
|
4263
|
+
// src/host/images/worth.ts
|
|
4264
|
+
const WORTH_RESULT = {
|
|
4265
|
+
type: "object",
|
|
4266
|
+
properties: {
|
|
4267
|
+
reason: {
|
|
4268
|
+
type: "string",
|
|
4269
|
+
description: "One short sentence, written first: what happens in the passage and whether there is something to look at."
|
|
4270
|
+
},
|
|
4271
|
+
worth: {
|
|
4272
|
+
type: "boolean",
|
|
4273
|
+
description: "Whether the moment deserves a picture."
|
|
4274
|
+
}
|
|
4275
|
+
},
|
|
4276
|
+
required: ["reason", "worth"],
|
|
4277
|
+
additionalProperties: false
|
|
4278
|
+
};
|
|
4279
|
+
/** Whether a moment of the story is worth a picture, as a helper with no tools judges it from what the player read. */
|
|
4280
|
+
async function worthAPicture(job) {
|
|
4281
|
+
const limits = {};
|
|
4282
|
+
if (job.reasoningEffort !== void 0) limits.reasoningEffort = job.reasoningEffort;
|
|
4283
|
+
if (job.sampling !== void 0) limits.sampling = job.sampling;
|
|
4284
|
+
return (await runChild({
|
|
4285
|
+
parent: job.parent,
|
|
4286
|
+
signal: job.signal,
|
|
4287
|
+
...limits,
|
|
4288
|
+
persona: promptFor(job.parent, "roleplay/image-worth", job.language),
|
|
4289
|
+
prompt: job.moment,
|
|
4290
|
+
result: WORTH_RESULT,
|
|
4291
|
+
maxCalls: 2
|
|
4292
|
+
})).worth;
|
|
4293
|
+
}
|
|
4263
4294
|
// src/host/images/jobs.ts
|
|
4264
4295
|
/** The same service, whose requests stand where the job's do unless a call says otherwise. */
|
|
4265
4296
|
function withPriority(service, priority, highRes) {
|
|
@@ -4293,9 +4324,9 @@ var ImageJobs = class {
|
|
|
4293
4324
|
const id = roleplaySessionOf(chat);
|
|
4294
4325
|
if (id === void 0) return;
|
|
4295
4326
|
const settings = this.deps.settings(id);
|
|
4296
|
-
if (settings.images.mode !== "every-turn") return;
|
|
4327
|
+
if (settings.images.mode !== "every-turn" && settings.images.mode !== "important") return;
|
|
4297
4328
|
try {
|
|
4298
|
-
this.start(id, node, this.assertNode(id, node).turn, output, settings, "background", true);
|
|
4329
|
+
this.start(id, node, this.assertNode(id, node).turn, output, settings, "background", true, settings.images.mode === "important");
|
|
4299
4330
|
} catch (error) {
|
|
4300
4331
|
const message = error instanceof Error ? error.message : String(error);
|
|
4301
4332
|
this.failures.set(this.key(id, node), message);
|
|
@@ -4315,8 +4346,9 @@ var ImageJobs = class {
|
|
|
4315
4346
|
/**
|
|
4316
4347
|
* @param priority - `foreground` when the player asked for the picture, `background` when it is made on its own after a turn and may wait behind the next one.
|
|
4317
4348
|
* @param automatic - the picture was not asked for: the library is looked at first, and the pictures the person brought are described before that.
|
|
4349
|
+
* @param selective - a helper first says whether the moment is worth a picture at all; when it is not, nothing is made and nothing is reported.
|
|
4318
4350
|
*/
|
|
4319
|
-
start(id, node, turn, output, settings, priority, automatic) {
|
|
4351
|
+
start(id, node, turn, output, settings, priority, automatic, selective = false) {
|
|
4320
4352
|
const current = this.active.get(id);
|
|
4321
4353
|
if (current?.node === node) return;
|
|
4322
4354
|
current?.controller.abort();
|
|
@@ -4326,7 +4358,7 @@ var ImageJobs = class {
|
|
|
4326
4358
|
if (parent === void 0) throw new Error("the roleplay agent is not loaded");
|
|
4327
4359
|
const controller = new AbortController();
|
|
4328
4360
|
this.failures.delete(this.key(id, node));
|
|
4329
|
-
const request = output.segments
|
|
4361
|
+
const request = wordsOf(output.segments, (segment) => `${segment.name}: “${segment.text}”`).join("\n");
|
|
4330
4362
|
const reuse = automatic && settings.images.reuse;
|
|
4331
4363
|
const tr = translator(languageOf$1(settings.prompts.language));
|
|
4332
4364
|
const present$1 = () => {
|
|
@@ -4358,6 +4390,14 @@ var ImageJobs = class {
|
|
|
4358
4390
|
return waiting === void 0 ? make() : waiting.then(make);
|
|
4359
4391
|
};
|
|
4360
4392
|
const makeOrShow = async () => {
|
|
4393
|
+
if (selective && !await (this.deps.worth ?? worthAPicture)({
|
|
4394
|
+
parent,
|
|
4395
|
+
signal: controller.signal,
|
|
4396
|
+
language: settings.prompts.language,
|
|
4397
|
+
moment: request,
|
|
4398
|
+
sampling: childSampling(settings, "records"),
|
|
4399
|
+
...settings.reasoning.children === "" ? {} : { reasoningEffort: settings.reasoning.children }
|
|
4400
|
+
})) return void 0;
|
|
4361
4401
|
const turns = store();
|
|
4362
4402
|
const picked = automatic && reuse && turns !== void 0 && this.deps.reuseExisting !== void 0 ? await this.deps.reuseExisting({
|
|
4363
4403
|
chat: chatSessionId(id),
|
|
@@ -4422,9 +4462,14 @@ var ImageJobs = class {
|
|
|
4422
4462
|
const attachments = this.deps.attachments?.();
|
|
4423
4463
|
const parent = this.deps.agentOf(chatSessionId(id));
|
|
4424
4464
|
const settings = this.deps.settings(id);
|
|
4425
|
-
if (attachments === void 0 || parent === void 0) return;
|
|
4426
4465
|
const folder = sessionFolder(this.deps.sessionsDir(), id);
|
|
4427
|
-
|
|
4466
|
+
const waiting = (await listGallery(folder)).filter((entry) => entry.pending);
|
|
4467
|
+
if (attachments === void 0 || parent === void 0) {
|
|
4468
|
+
const reason = attachments === void 0 ? "this DSH profile has no attachment service, so a picture cannot be shown to a model" : "the story's chat is not loaded: open the chat once, then refresh";
|
|
4469
|
+
for (const image of waiting) this.interpretFailures.set(image.path, reason);
|
|
4470
|
+
return;
|
|
4471
|
+
}
|
|
4472
|
+
for (const image of waiting) {
|
|
4428
4473
|
if (signal.aborted) return;
|
|
4429
4474
|
try {
|
|
4430
4475
|
await (this.deps.interpret ?? interpretImage)({
|
|
@@ -4711,7 +4756,7 @@ function apply(ctx) {
|
|
|
4711
4756
|
turnOf: currentTurn,
|
|
4712
4757
|
roller: (chat) => rolls.roller(chat),
|
|
4713
4758
|
delivered: (chat, output) => {
|
|
4714
|
-
turnTraces.output(chat, output.segments
|
|
4759
|
+
turnTraces.output(chat, wordsOf(output.segments, (segment) => `${segment.name}: ${segment.text}`).join("\n\n"));
|
|
4715
4760
|
const node = timelines.delivered(chat, output);
|
|
4716
4761
|
if (node !== void 0) images.afterDelivery(chat, node, output);
|
|
4717
4762
|
return node;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { A as chatSessionId } from "./child-Bfj7-Iuo.js";
|
|
2
|
-
import { $t as
|
|
3
|
-
import {
|
|
4
|
-
import { n as encodeOutput } from "./narration-
|
|
2
|
+
import { $t as authoredWorldOf, A as loadWorldParts, Bt as commandVariable, Ct as loadDice, D as worldFieldChanges, Dt as parseCalendarFile, Et as loadCalendar, F as editsSince, G as addressesToFetch, Ht as parseCommandsFile, I as writeSnapshot, K as candidateUrls, Lt as pieceFinder, Mt as UPDATE_FOLDER, Nt as baseId, O as editWorldInfo, Ot as CHARACTERS_DIR, P as recordProvenance, Pt as cardPieces, Q as writePortrait, Qt as DICE_RESULTS, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, Ut as TRIGGERS_FILE_NAME, Vt as loadCommands, W as addressKey, Wt as loadTriggers, Xt as DICE_COMPARISONS, Y as mergeReports, Z as cardCharacter, Zt as DICE_READINGS, _t as loadLocations, bt as FACTIONS_DIR, en as authoringChatSessionId, et as loadValidatedWorld, f as importPhase, gt as LOCATIONS_DIR, ht as routineProblems, kt as loadCharacters, nt as knowsCharacter, o as contextOf, q as fetchPictures, tt as withScratchStory, u as worldOf, vt as ITEMS_DIR, wt as parseDiceFile, xt as loadFactions, yt as loadItems, zt as COMMANDS_FILE_NAME } from "./authoring-tools-CKV1UnN7.js";
|
|
3
|
+
import { At as subfolders, Ft as IMPORT_FOLDER, H as parseWorldFile, Ht as writeChoices, Ot as LORE_DIR, Pt as withPlayer, Rt as PICTURE_FILE, Ut as InvalidEditProblems, V as WORLD_FILE_NAME, Vt as readImportFolder, _n as CHARACTER_FILE_NAME, an as parseVariablesFile, cn as parseLoreFile, dn as ITEM_FILE_NAME, f as extractStyleFrom, gn as parseFactionFile, hn as FACTION_FILE_NAME, in as loadVariables, kt as loadLore, ln as LOCATION_FILE_NAME, mt as writeWorldPrompt, on as variableProblems, pn as parseItemFile, rn as VARIABLES_FILE_NAME, sn as LORE_FILE_NAME, un as parseLocationFile, vn as parseCharacterFile } from "./serial-xcAG57p_.js";
|
|
4
|
+
import { n as encodeOutput } from "./narration-CUZIXzab.js";
|
|
5
5
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-5vtPAT3O.js";
|
|
6
|
-
import { B as parsePlotsFile, F as textLanguage,
|
|
7
|
-
import { i as translator, r as languageOf } from "./text-
|
|
8
|
-
import {
|
|
9
|
-
import { n as readPreset } from "./preset-
|
|
10
|
-
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-
|
|
11
|
-
import {
|
|
6
|
+
import { B as parsePlotsFile, F as textLanguage, J as formatIssue, M as LANGUAGE_NAMES, N as STORY_LANGUAGES, P as isStoryLanguage, R as PLOTS_FILE_NAME, V as plotReferenceProblems, Z as PROMPTS_FOLDER, gt as runCommandLine, it as shippedLanguages, lt as InvalidWorldError, mt as CommandRefusedError, pt as WorldNotFoundError, q as Reader, st as AgentUnavailableError, z as loadPlots } from "./hooks-CnxV2uEh.js";
|
|
7
|
+
import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
|
|
8
|
+
import { C as mapLimit, m as referenceImagePath, v as readImageFileMetadata } from "./gallery-CT5uj50b.js";
|
|
9
|
+
import { n as readPreset } from "./preset-BO8iWQ-n.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-DU171pDX.js";
|
|
11
|
+
import { l as generateReferenceImage, p as uploadReferenceImage } from "./interpreter-Cz5qsuXk.js";
|
|
12
12
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
13
13
|
import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
|
|
14
14
|
import { existsSync, lstatSync, statSync } from "node:fs";
|
|
@@ -56,6 +56,9 @@ function appendNarratedTurn(session, turn, output, player) {
|
|
|
56
56
|
type: "utterance",
|
|
57
57
|
character: segment.character,
|
|
58
58
|
text: segment.text
|
|
59
|
+
} : segment.type === "image" ? {
|
|
60
|
+
type: "image",
|
|
61
|
+
path: segment.path
|
|
59
62
|
} : {
|
|
60
63
|
type: "narration",
|
|
61
64
|
text: segment.text
|
|
@@ -687,7 +690,7 @@ async function finishUpdate(directory, options = {}) {
|
|
|
687
690
|
recursive: true,
|
|
688
691
|
force: true
|
|
689
692
|
});
|
|
690
|
-
const pictures = await updatePictures(directory, current.card.urls ?? [], next.card.urls ?? [], options);
|
|
693
|
+
const pictures = await updatePictures(directory, current.card.urls ?? [], next.choices.fetchPictures === false ? [] : next.card.urls ?? [], pieceFinder(next.card, next.choices), options);
|
|
691
694
|
const portrait = newPicture === void 0 ? "none" : oldPicture !== void 0 && oldPicture.equals(newPicture) ? "kept" : await refreshPortrait(directory, newPicture, next.card.name);
|
|
692
695
|
await recordProvenance(directory, {
|
|
693
696
|
kind: "update",
|
|
@@ -703,11 +706,14 @@ async function finishUpdate(directory, options = {}) {
|
|
|
703
706
|
};
|
|
704
707
|
}
|
|
705
708
|
/** Fetches what the newer card points to that the world does not have yet, keeps the record of the fetches, and says which fetched pictures the card no longer points to. */
|
|
706
|
-
async function updatePictures(directory, earlier, later, options) {
|
|
709
|
+
async function updatePictures(directory, earlier, later, piecesOf, options) {
|
|
707
710
|
const file = join(directory, IMPORT_FOLDER, "pictures.json");
|
|
708
711
|
const record = await readFile(file, "utf8").then((text) => JSON.parse(text), () => void 0);
|
|
709
712
|
const ask = addressesToFetch(earlier, later, record);
|
|
710
|
-
const report = ask.length === 0 ? void 0 : await (options.fetcher ?? fetchPictures)(directory, ask,
|
|
713
|
+
const report = ask.length === 0 ? void 0 : await (options.fetcher ?? fetchPictures)(directory, ask, {
|
|
714
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
715
|
+
piecesOf
|
|
716
|
+
}).catch(() => ({
|
|
711
717
|
found: 0,
|
|
712
718
|
added: [],
|
|
713
719
|
skipped: []
|
|
@@ -3227,4 +3233,4 @@ function registerPackJail(ctx, deps) {
|
|
|
3227
3233
|
}
|
|
3228
3234
|
export { languageOfDocuments as $, generateWorldCharacterPortrait as A, deleteTriggerDocument as B, editWorldFaction as C, editWorldPlots as D, editWorldPlace as E, uploadWorldCharacterPortrait as F, parseVariablesEdit as G, writeTriggerDocument as H, uploadWorldEntityImage as I, PRESET_FILE as J, parseDiceEdit as K, worldCharacterPortraitFile as L, readWorldEditor as M, readWorldTrigger as N, editWorldRelation as O, removeWorldTrigger as P, translateTools as Q, worldEntityImageFile as R, editWorldCharacter as S, editWorldNarrationVoice as T, parseCalendarEdit as U, readTriggerDocuments as V, parseRoutineEdit as W, presetTools as X, presetMessage as Y, translateMessage as Z, readCalendarDocument as _, deleteWorldPackFile as a, startUpdate as at, readRoutines as b, createAuthoredEntity as c, authoringTitle as ct, replaceAuthoredEntity as d, agentServicesOf as dt, readWorldDocuments as et, editCalendar as f, DOCTOR_OPENING_SOURCE as ft, editVariables as g, editRoutine as h, checkWorldPack as i, revertUpdate as it, generateWorldEntityImage as j, editWorldThing as k, deleteAuthoredEntity as l, ensureAuthoringChat as lt, editDice as m, appendNarratedTurn as mt, packFileProblem as n, finishUpdate as nt, listWorldPacks as o, updateStatus as ot, editCommands as p, appendEmptyTurn as pt, parseCommandsEdit as q, registerPackJail as r, pendingUpdate as rt, AUTHORED_ENTITY_KINDS as s, AuthoringSessions as st, MAX_PACK_TEXT as t, findTargets as tt, readAuthoredEntityDocument as u, AgentSessions as ut, readCommandsDocument as v, editWorldLore as w, readVariables as x, readDiceDocument as y, writeWorldTrigger as z };
|
|
3229
3235
|
|
|
3230
|
-
//# sourceMappingURL=pack-jail-
|
|
3236
|
+
//# sourceMappingURL=pack-jail-KyZen_gy.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as Reader } from "./hooks-CnxV2uEh.js";
|
|
2
2
|
import { dirname, extname, join, posix, sep } from "node:path";
|
|
3
3
|
import { copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync } from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -836,4 +836,4 @@ function anyTab(bases) {
|
|
|
836
836
|
}
|
|
837
837
|
export { API_PREFIX as _, packIds as a, describePack as c, packPath as d, readPack as f, SURFACE_NAMES as g, PACK_MEDIA_TYPES as h, inheritPacks as i, isPackId as l, PACK_LIMITS as m, anyTab as n, syncWorldPacks as o, PACK_ACTIONS as p, copyWorldPacks as r, worldPackStates as s, activePack as t, packFile as u };
|
|
838
838
|
|
|
839
|
-
//# sourceMappingURL=packs-
|
|
839
|
+
//# sourceMappingURL=packs-DU171pDX.js.map
|