@dsh-agentic-roleplay/core 0.12.0 → 0.12.2
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/cordis.patch.yml +108 -0
- package/lib/{access-DAw54-NI.js → access-Csp80TFX.js} +2 -2
- package/lib/{authoring-tools-4NgDhIJV.js → authoring-tools-BZr4bgBy.js} +25 -771
- package/lib/authoring.js +136 -12
- package/lib/{child-D3QUNb3m.js → child-DTdY14S9.js} +54 -6
- package/lib/client.js +16457 -1938
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/dev-context-Cgv_wZbG.js +50 -0
- package/lib/doctor.js +6 -3
- package/lib/{gallery-Ct6nm4UQ.js → gallery-BNg0rPTp.js} +3 -3
- package/lib/{generator-CI8fOnXy.js → generator-9-5at9cZ.js} +2 -2
- package/lib/helper.js +5 -9
- package/lib/{hooks-BNeoGMHZ.js → hooks-Dtq5KZQX.js} +47 -16
- package/lib/images.js +4 -4
- package/lib/index.js +152 -476
- package/lib/{jail-BIF79PJO.js → jail-DVbPSC0R.js} +2 -2
- package/lib/{library-BF9ZMSFz.js → library-DTxakw0z.js} +2 -2
- package/lib/{lorebook-author-tools-DBk-V0hp.js → lorebook-author-tools-BjcEUo22.js} +19 -6
- package/lib/lorebook-authoring.js +13 -5
- package/lib/{narration-xvErE2yp.js → narration--K2XVIHI.js} +2 -2
- package/lib/orchestration.js +33 -12
- package/lib/{pack-jail-C8EyX9Ix.js → pack-jail-Dt0VTsu0.js} +558 -23
- package/lib/{packs-S0SzrVv-.js → packs-DWfR2Ted.js} +2 -2
- package/lib/{presenter-agent-Bc478nTA.js → presenter-agent-vFOxIuWv.js} +9 -9
- package/lib/{preset-SJZyw0kt.js → preset-Dv5YF2qj.js} +4 -4
- package/lib/{preset-author-tools-CzogjK42.js → preset-author-tools-BUzO9mTW.js} +8 -7
- package/lib/preset-authoring.js +12 -6
- package/lib/{reflection-buQiSdvq.js → reflection-Dd3pEiZB.js} +14 -15
- package/lib/{presets-DQ5rioMh.js → serial-BUaJGwVy.js} +1241 -390
- package/lib/{turn-guard-BSAba8sp.js → turn-guard-87NE-Cnp.js} +3 -3
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +34 -34
- package/prompts/en/import/style.md +2 -1
- package/prompts/en/world/procedure.md +1 -1
- package/prompts/zh/import/style.md +2 -1
- package/prompts/zh/world/procedure.md +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as atomicWrite, t as promptFor } from "./access-
|
|
2
|
-
import { l as runChild } from "./child-
|
|
3
|
-
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-
|
|
4
|
-
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-
|
|
5
|
-
import { c as nextSceneSerial, u as referenceImagePath } from "./library-
|
|
6
|
-
import { join, relative } from "node:path";
|
|
1
|
+
import { n as atomicWrite, t as promptFor } from "./access-Csp80TFX.js";
|
|
2
|
+
import { l as runChild } from "./child-DTdY14S9.js";
|
|
3
|
+
import { n as generateTransientImage, t as generateReferenceImage } from "./generator-9-5at9cZ.js";
|
|
4
|
+
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BNg0rPTp.js";
|
|
5
|
+
import { c as nextSceneSerial, u as referenceImagePath } from "./library-DTxakw0z.js";
|
|
6
|
+
import { join, relative, sep } from "node:path";
|
|
7
7
|
import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -450,7 +450,7 @@ function imageTools(deps) {
|
|
|
450
450
|
...args.art_direction === void 0 ? {} : { artDirection: args.art_direction },
|
|
451
451
|
...deps.signal === void 0 ? {} : { signal: deps.signal }
|
|
452
452
|
});
|
|
453
|
-
const local = relative(deps.root, path);
|
|
453
|
+
const local = relative(deps.root, path).split(sep).join("/");
|
|
454
454
|
recorded.push(local);
|
|
455
455
|
return { path: local };
|
|
456
456
|
}
|
|
@@ -543,7 +543,7 @@ function imageTools(deps) {
|
|
|
543
543
|
...references.length === 0 ? {} : { references },
|
|
544
544
|
...deps.signal === void 0 ? {} : { signal: deps.signal }
|
|
545
545
|
});
|
|
546
|
-
const local = relative(deps.root, path);
|
|
546
|
+
const local = relative(deps.root, path).split(sep).join("/");
|
|
547
547
|
recorded.push(local);
|
|
548
548
|
return {
|
|
549
549
|
path: local,
|
|
@@ -844,4 +844,4 @@ async function runImagePresenter(job) {
|
|
|
844
844
|
}
|
|
845
845
|
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 };
|
|
846
846
|
|
|
847
|
-
//# sourceMappingURL=presenter-agent-
|
|
847
|
+
//# sourceMappingURL=presenter-agent-vFOxIuWv.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p as SAMPLING_RANGES } from "./child-
|
|
3
|
-
import {
|
|
1
|
+
import { Rt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BZr4bgBy.js";
|
|
2
|
+
import { p as SAMPLING_RANGES } from "./child-DTdY14S9.js";
|
|
3
|
+
import { gt as cleanText } from "./serial-BUaJGwVy.js";
|
|
4
4
|
// src/host/import/preset.ts
|
|
5
5
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
6
6
|
const LEGACY_KEYS = [
|
|
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
239
239
|
}
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-Dv5YF2qj.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./access-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import { i as contextOf } from "./authoring-tools-
|
|
1
|
+
import "./access-Csp80TFX.js";
|
|
2
|
+
import { $ as deleteWorldPrompt, K as presetDirectory, Q as PROSE_PROMPTS, Z as updatePresetInfo, bt as IMPORT_FOLDER, et as listWorldPrompts, l as extractStyleFrom, nt as writeWorldPrompt, q as readPreset, tt as readWorldPrompt, yt as withPlayer, z as PRESET_FILE } from "./serial-BUaJGwVy.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-Dv5YF2qj.js";
|
|
4
|
+
import { i as contextOf } from "./authoring-tools-BZr4bgBy.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import {
|
|
6
|
+
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-Dtq5KZQX.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -234,10 +234,11 @@ function presetAuthorTools(reader, settings, prompting, shipped = shippedPrompts
|
|
|
234
234
|
];
|
|
235
235
|
}
|
|
236
236
|
/** Every change to a preset is put to the person; the first import into an empty preset only fills it, so it is not. */
|
|
237
|
-
async function presetApproval(exec, next, carries) {
|
|
237
|
+
async function presetApproval(exec, next, carries, auto = () => false) {
|
|
238
238
|
if (!PRESET_MUTATION_TOOLS.includes(exec.name) || exec.agent === void 0 || presetOfChat(exec.agent.session.id) === void 0) return await next();
|
|
239
239
|
const args = exec.arguments;
|
|
240
240
|
const chat = exec.agent.session.id;
|
|
241
|
+
if (auto() && !isRulesPrompt(args["id"])) return await next();
|
|
241
242
|
if (exec.name === "import_narration_preset") {
|
|
242
243
|
if (!carries(chat)) return await next();
|
|
243
244
|
return {
|
|
@@ -278,4 +279,4 @@ async function presetApproval(exec, next, carries) {
|
|
|
278
279
|
}
|
|
279
280
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
280
281
|
|
|
281
|
-
//# sourceMappingURL=preset-author-tools-
|
|
282
|
+
//# sourceMappingURL=preset-author-tools-BUzO9mTW.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools-BZr4bgBy.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-87NE-Cnp.js";
|
|
3
|
+
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BUzO9mTW.js";
|
|
5
|
+
import "./hooks-Dtq5KZQX.js";
|
|
6
|
+
import { K as presetDirectory } from "./serial-BUaJGwVy.js";
|
|
6
7
|
import { join } from "node:path";
|
|
7
8
|
import { existsSync } from "node:fs";
|
|
8
9
|
// src/preset-authoring.ts
|
|
@@ -18,6 +19,8 @@ const inject = [
|
|
|
18
19
|
];
|
|
19
20
|
/** The preset authoring chat: reads and writes the prose prompts of one library preset, each write approved by the person. */
|
|
20
21
|
function apply(ctx) {
|
|
22
|
+
silenceHarnessDevContext(ctx);
|
|
23
|
+
silenceRuntimeContext(ctx);
|
|
21
24
|
const library = () => ctx.roleplayRoot.path;
|
|
22
25
|
const reader = new PresetReader(library);
|
|
23
26
|
const prompting = {
|
|
@@ -34,7 +37,10 @@ function apply(ctx) {
|
|
|
34
37
|
const preset = presetOfChat(chat);
|
|
35
38
|
return preset === void 0 ? void 0 : ctx.roleplayAuthoringLanguages.get(`preset:${preset}`);
|
|
36
39
|
}, () => ctx.roleplayImport.settings.reasoning);
|
|
37
|
-
ctx.on("
|
|
40
|
+
ctx.on("session/event", (session, event) => {
|
|
41
|
+
if (event.type === "turn/end" && session.header.origin !== "subagent" && presetOfChat(session.id) !== void 0) ctx.roleplayImport.turnEnded(session.id);
|
|
42
|
+
});
|
|
43
|
+
ctx.on("tools/pre-execute", (exec, next) => presetApproval(exec, next, carries, () => ctx.roleplayImport.settings.approval === "auto"));
|
|
38
44
|
const languageOf = (context) => {
|
|
39
45
|
const chat = context.agent?.session.id;
|
|
40
46
|
const preset = chat === void 0 ? void 0 : presetOfChat(chat);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-
|
|
2
|
-
import {
|
|
3
|
-
import { t as promptFor } from "./access-
|
|
4
|
-
import {
|
|
1
|
+
import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-DTdY14S9.js";
|
|
2
|
+
import { A as routeVerdicts, D as mergeReports, E as askYesNo, G as loadPreset, T as announceProblem, W as listPresets, X as sha, j as yesAt, k as noAt, t as SerialQueue } from "./serial-BUaJGwVy.js";
|
|
3
|
+
import { t as promptFor } from "./access-Csp80TFX.js";
|
|
4
|
+
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, ht as describeWhen } from "./hooks-Dtq5KZQX.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import { s as inheritImages } from "./library-
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
6
|
+
import { s as inheritImages } from "./library-DTxakw0z.js";
|
|
7
|
+
import { i as inheritPacks } from "./packs-DWfR2Ted.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { characterKey, locationKey, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
10
10
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -342,14 +342,12 @@ var TimelineError = class extends Error {};
|
|
|
342
342
|
*/
|
|
343
343
|
var Timelines = class {
|
|
344
344
|
deps;
|
|
345
|
-
|
|
345
|
+
queue = new SerialQueue();
|
|
346
346
|
constructor(deps) {
|
|
347
347
|
this.deps = deps;
|
|
348
348
|
}
|
|
349
349
|
serial(chat, job) {
|
|
350
|
-
|
|
351
|
-
this.queues.set(chat, run.catch(() => void 0));
|
|
352
|
-
return run;
|
|
350
|
+
return this.queue.run(chat, job);
|
|
353
351
|
}
|
|
354
352
|
idOf(chat) {
|
|
355
353
|
const id = roleplaySessionOf(chat);
|
|
@@ -416,19 +414,20 @@ var Timelines = class {
|
|
|
416
414
|
/**
|
|
417
415
|
* The turn ended in the log. Its own message is found now: it is the first message of the player after the last turn that ended
|
|
418
416
|
* (it is not in the log yet when the turn begins).
|
|
417
|
+
* @param beganSeq - where that turn's own `turn/start` sits, so the log is not searched for it.
|
|
419
418
|
*/
|
|
420
|
-
ended(chat, session, seq) {
|
|
419
|
+
ended(chat, session, seq, beganSeq) {
|
|
421
420
|
const id = this.idOf(chat);
|
|
422
421
|
const timeline = this.read(id);
|
|
423
422
|
const node = timeline.nodes.find((candidate) => candidate.id === timeline.head);
|
|
424
423
|
if (node === void 0 || node.endSeq !== void 0) return;
|
|
425
424
|
const after = Math.max(-1, ...timeline.nodes.filter((other) => other.id !== node.id).map((other) => other.endSeq ?? other.userSeq));
|
|
426
|
-
const human = session.snapshotEvents().find((event) => event.seq > after && event.type === "user/message" && event.data.source.kind === "user");
|
|
425
|
+
const human = session.snapshotEvents(after + 1).find((event) => event.seq > after && event.type === "user/message" && event.data.source.kind === "user");
|
|
427
426
|
if (human === void 0) throw new TimelineError(`turn ${node.turn} has no message of the player in the log`);
|
|
428
427
|
node.userSeq = human.seq;
|
|
429
428
|
node.endSeq = seq;
|
|
430
|
-
const began = session.snapshotEvents().find((event) => event.type === "turn/start" && event.data.turn === node.turn);
|
|
431
|
-
node.startSeq = Math.min(began
|
|
429
|
+
const began = beganSeq ?? session.snapshotEvents(0).find((event) => event.type === "turn/start" && event.data.turn === node.turn)?.seq;
|
|
430
|
+
node.startSeq = Math.min(began ?? human.seq, human.seq);
|
|
432
431
|
writeTimeline(this.folder(id), timeline);
|
|
433
432
|
}
|
|
434
433
|
/** Keeps the state as it is under the name of the turn it follows from, when that is not done yet. */
|
|
@@ -1505,4 +1504,4 @@ function memoryReflector(deps) {
|
|
|
1505
1504
|
}
|
|
1506
1505
|
export { snapshotOf as _, whereabouts as a, copyPreset as c, switchPreset as d, readTimeline as f, pathTo as g, childrenOf as h, reflectionStatus as i, presetStatus as l, START_SNAPSHOT as m, memoryReflector as n, TimelineError as o, writeTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u };
|
|
1507
1506
|
|
|
1508
|
-
//# sourceMappingURL=reflection-
|
|
1507
|
+
//# sourceMappingURL=reflection-Dd3pEiZB.js.map
|