@dsh-agentic-roleplay/core 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{authoring-tools-B4mEdKp_.js → authoring-tools-C6Hzy8jU.js} +1425 -1241
- package/lib/authoring.js +18 -7
- package/lib/{child-Dtv76jNx.js → child-C8r8AFpm.js} +36 -5
- package/lib/client.js +1780 -829
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +2 -2
- package/lib/doctor.js +2 -2
- package/lib/{gallery-BZJleAeH.js → gallery-CtG-bDzz.js} +2 -2
- package/lib/{generator-Cg6CQc5S.js → generator-nLoPM5MF.js} +2 -2
- package/lib/helper.js +1 -1
- package/lib/{hooks-DTjHWTfx.js → hooks-BuQ61nvQ.js} +105 -61
- package/lib/images.js +4 -4
- package/lib/index.js +964 -106
- package/lib/{library-GIlrkOim.js → library-CH-ahlm0.js} +2 -2
- package/lib/{lorebook-author-tools-BCFFJSle.js → lorebook-author-tools-B6_Jj8oe.js} +6 -6
- package/lib/lorebook-authoring.js +4 -4
- package/lib/{narration-BVzew4-K.js → narration-B0hConSw.js} +5 -2
- package/lib/orchestration.js +50 -13
- package/lib/{pack-jail-hsNQNTOf.js → pack-jail-OZSgU85i.js} +10 -10
- package/lib/{packs-UpK_cvI4.js → packs-B88bxt8E.js} +2 -2
- package/lib/{presenter-agent-DZOgBOR9.js → presenter-agent-D-WNs626.js} +5 -5
- package/lib/{preset-Cyoj1ZWa.js → preset-DNuqvMan.js} +4 -4
- package/lib/{preset-author-tools-RSta6pHK.js → preset-author-tools-CDwavcTb.js} +6 -6
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-CvpsW_10.js → presets-9_MNxwaw.js} +103 -7
- package/lib/{reflection-0qTvw2It.js → reflection-BvM0w1R4.js} +132 -92
- package/lib/{text-CbGQhK1-.js → text-CzqhC8sT.js} +11 -1
- package/lib/{turn-guard-BzNeGNnc.js → turn-guard-Ygdww1Wt.js} +3 -3
- package/package.json +2 -2
- package/prompts/en/checks/decide-stated.md +1 -0
- package/prompts/zh/checks/decide-stated.md +1 -0
package/lib/compaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as liveSettings, t as decodeOutput } from "./narration-
|
|
1
|
+
import { a as liveSettings, t as decodeOutput } from "./narration-B0hConSw.js";
|
|
2
2
|
import { l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
3
|
-
import {
|
|
3
|
+
import { C as tokensOf, c as runChild, n as childModel, r as childSampling } from "./child-C8r8AFpm.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
6
6
|
import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
package/lib/doctor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as chatSessionId } from "./access-CXtaZNbx.js";
|
|
2
2
|
import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
|
|
3
|
-
import { i as externalTools, t as externalToolLimit } from "./hooks-
|
|
4
|
-
import { a as liveSettings } from "./narration-
|
|
3
|
+
import { i as externalTools, t as externalToolLimit } from "./hooks-BuQ61nvQ.js";
|
|
4
|
+
import { a as liveSettings } from "./narration-B0hConSw.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as atomicWrite } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-
|
|
2
|
+
import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
3
3
|
import { join, sep } from "node:path";
|
|
4
4
|
import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
5
5
|
// src/host/images/gallery.ts
|
|
@@ -187,4 +187,4 @@ async function updateImage(sessionFolder, path, update) {
|
|
|
187
187
|
}
|
|
188
188
|
export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
|
|
189
189
|
|
|
190
|
-
//# sourceMappingURL=gallery-
|
|
190
|
+
//# sourceMappingURL=gallery-CtG-bDzz.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-
|
|
1
|
+
import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-CH-ahlm0.js";
|
|
2
2
|
// src/host/images/generator.ts
|
|
3
3
|
const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
4
4
|
/** What a reference image shows: the subject and its stable look. */
|
|
@@ -141,4 +141,4 @@ async function generateTransientImage(service, request) {
|
|
|
141
141
|
}
|
|
142
142
|
export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
|
|
143
143
|
|
|
144
|
-
//# sourceMappingURL=generator-
|
|
144
|
+
//# sourceMappingURL=generator-nLoPM5MF.js.map
|
package/lib/helper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { _ as emptyStats, a as liveSettings, h as DECISION_SITES, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-
|
|
3
|
-
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-
|
|
4
|
-
import { _ as addTokens, a as childTrace, c as runChild, f as requestsOf, g as NO_TOKENS, h as tokensOf, m as estimateTokens, n as childModel, p as blockText, r as childSampling
|
|
2
|
+
import { _ as emptyStats, a as liveSettings, h as DECISION_SITES, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-B0hConSw.js";
|
|
3
|
+
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-CzqhC8sT.js";
|
|
4
|
+
import { S as estimateAnswer, _ as addTokens, a as childTrace, c as runChild, f as requestsOf, g as NO_TOKENS, h as tokensOf, m as estimateTokens, n as childModel, p as blockText, r as childSampling } from "./child-C8r8AFpm.js";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { readFile, stat } from "node:fs/promises";
|
|
@@ -559,6 +559,43 @@ function plotReferenceProblems(plots, entities) {
|
|
|
559
559
|
const known = new Set(entities);
|
|
560
560
|
return plots.flatMap((plot) => plot.participants.filter((participant) => !known.has(participant)).map((participant) => `plot "${plot.id}" names unknown participant "${participant}"`));
|
|
561
561
|
}
|
|
562
|
+
// src/host/sessions/usage.ts
|
|
563
|
+
const KEY$5 = "usage";
|
|
564
|
+
const isCount = (value) => typeof value === "object" && value !== null && [
|
|
565
|
+
"input",
|
|
566
|
+
"cached",
|
|
567
|
+
"output"
|
|
568
|
+
].every((field) => typeof value[field] === "number");
|
|
569
|
+
const isUsage = (value) => typeof value === "object" && value !== null && typeof value.turn === "number" && typeof value.runs === "number" && isCount(value.master) && isCount(value.helpers);
|
|
570
|
+
/** What each turn used, oldest first. The record belongs to the story's state, so taking the story back takes the turns that no longer count with it. */
|
|
571
|
+
function readUsage(session) {
|
|
572
|
+
const stored = session.metadata.getValue(KEY$5);
|
|
573
|
+
return Array.isArray(stored) ? stored.filter(isUsage) : [];
|
|
574
|
+
}
|
|
575
|
+
/** Adds tokens to a turn's record: the game master's own, or a helper's run. */
|
|
576
|
+
function addUsage(session, turn, who, tokens, masterMs) {
|
|
577
|
+
const all = readUsage(session);
|
|
578
|
+
const at = all.findIndex((entry) => entry.turn === turn);
|
|
579
|
+
const entry = at === -1 ? {
|
|
580
|
+
turn,
|
|
581
|
+
master: NO_TOKENS,
|
|
582
|
+
helpers: NO_TOKENS,
|
|
583
|
+
runs: 0
|
|
584
|
+
} : all[at];
|
|
585
|
+
const next = who === "master" ? {
|
|
586
|
+
...entry,
|
|
587
|
+
master: addTokens(entry.master, tokens),
|
|
588
|
+
...masterMs === void 0 ? {} : { masterMs: (entry.masterMs ?? 0) + masterMs }
|
|
589
|
+
} : {
|
|
590
|
+
...entry,
|
|
591
|
+
helpers: addTokens(entry.helpers, tokens),
|
|
592
|
+
runs: entry.runs + 1
|
|
593
|
+
};
|
|
594
|
+
if (at === -1) all.push(next);
|
|
595
|
+
else all[at] = next;
|
|
596
|
+
all.sort((a, b) => a.turn - b.turn);
|
|
597
|
+
session.metadata.setValue(KEY$5, all);
|
|
598
|
+
}
|
|
562
599
|
// src/host/translate/language.ts
|
|
563
600
|
const STORY_LANGUAGES = ["en", "zh"];
|
|
564
601
|
/** Less than this many letters of either script is too little to tell a language. */
|
|
@@ -1024,7 +1061,7 @@ const NOTE_KINDS = [
|
|
|
1024
1061
|
"world"
|
|
1025
1062
|
];
|
|
1026
1063
|
// src/host/sessions/notes.ts
|
|
1027
|
-
const KEY$
|
|
1064
|
+
const KEY$4 = "notes";
|
|
1028
1065
|
const isNote = (value) => {
|
|
1029
1066
|
if (typeof value !== "object" || value === null) return false;
|
|
1030
1067
|
const note = value;
|
|
@@ -1032,12 +1069,12 @@ const isNote = (value) => {
|
|
|
1032
1069
|
};
|
|
1033
1070
|
/** The notes of a session, at most one per kind. */
|
|
1034
1071
|
function readNotes(session) {
|
|
1035
|
-
const stored = session.metadata.getValue(KEY$
|
|
1072
|
+
const stored = session.metadata.getValue(KEY$4);
|
|
1036
1073
|
return Array.isArray(stored) ? stored.filter(isNote) : [];
|
|
1037
1074
|
}
|
|
1038
1075
|
/** Replaces the note of the same kind. */
|
|
1039
1076
|
function putNote(session, note) {
|
|
1040
|
-
session.metadata.setValue(KEY$
|
|
1077
|
+
session.metadata.setValue(KEY$4, [...readNotes(session).filter((existing) => existing.kind !== note.kind), note]);
|
|
1041
1078
|
}
|
|
1042
1079
|
/** The most lines one note keeps: what is past it is not told. */
|
|
1043
1080
|
const MAX_NOTE_LINES = 8;
|
|
@@ -1052,7 +1089,7 @@ function addToNote(session, kind, turn, lines) {
|
|
|
1052
1089
|
}
|
|
1053
1090
|
/** Removes every note: they belong to the turn that made them. */
|
|
1054
1091
|
function clearNotes(session) {
|
|
1055
|
-
if (readNotes(session).length > 0) session.metadata.setValue(KEY$
|
|
1092
|
+
if (readNotes(session).length > 0) session.metadata.setValue(KEY$4, []);
|
|
1056
1093
|
}
|
|
1057
1094
|
/**
|
|
1058
1095
|
* The notes of a session, for the player's screen.
|
|
@@ -1113,10 +1150,10 @@ function masterTrace(events) {
|
|
|
1113
1150
|
};
|
|
1114
1151
|
}
|
|
1115
1152
|
// src/host/triggers/deliver.ts
|
|
1116
|
-
const KEY$
|
|
1153
|
+
const KEY$3 = "triggers.withdrawn";
|
|
1117
1154
|
/** Why a note was withdrawn instead of told, by the number of the note. */
|
|
1118
1155
|
function readWithdrawn(session) {
|
|
1119
|
-
const stored = session.metadata.getValue(KEY$
|
|
1156
|
+
const stored = session.metadata.getValue(KEY$3);
|
|
1120
1157
|
if (!Array.isArray(stored)) return {};
|
|
1121
1158
|
return Object.fromEntries(stored.flatMap((entry) => {
|
|
1122
1159
|
const { note, reason } = entry ?? {};
|
|
@@ -1135,7 +1172,7 @@ function deliverNow(session, notes, clock) {
|
|
|
1135
1172
|
note: Number(note),
|
|
1136
1173
|
reason
|
|
1137
1174
|
}));
|
|
1138
|
-
session.metadata.setValue(KEY$
|
|
1175
|
+
session.metadata.setValue(KEY$3, [...before, ...withdrawn.map(({ note, reason }) => ({
|
|
1139
1176
|
note: note.id,
|
|
1140
1177
|
reason
|
|
1141
1178
|
}))].slice(-100));
|
|
@@ -1146,9 +1183,9 @@ function deliverNow(session, notes, clock) {
|
|
|
1146
1183
|
}));
|
|
1147
1184
|
}
|
|
1148
1185
|
// src/host/triggers/judged.ts
|
|
1149
|
-
const KEY$
|
|
1186
|
+
const KEY$2 = "triggers.judged";
|
|
1150
1187
|
function readVerdicts(session) {
|
|
1151
|
-
const stored = session.metadata.getValue(KEY$
|
|
1188
|
+
const stored = session.metadata.getValue(KEY$2);
|
|
1152
1189
|
if (typeof stored !== "object" || stored === null || Array.isArray(stored)) return {};
|
|
1153
1190
|
const verdicts = {};
|
|
1154
1191
|
for (const [statement, value] of Object.entries(stored)) {
|
|
@@ -1162,7 +1199,7 @@ function readVerdicts(session) {
|
|
|
1162
1199
|
}
|
|
1163
1200
|
/** Keeps the verdicts of the given statements as they stand and drops every other: a statement no trigger waits on is no longer judged. */
|
|
1164
1201
|
function writeVerdicts(session, verdicts, keep) {
|
|
1165
|
-
session.metadata.setValue(KEY$
|
|
1202
|
+
session.metadata.setValue(KEY$2, Object.fromEntries(Object.entries(verdicts).filter(([statement]) => keep.has(statement))));
|
|
1166
1203
|
}
|
|
1167
1204
|
/** For `runTriggers`: a statement is true when its last verdict says so, and false when nobody judged it. */
|
|
1168
1205
|
const verdictReader = (session) => {
|
|
@@ -1296,11 +1333,11 @@ function noteStore(session, settings, clock) {
|
|
|
1296
1333
|
};
|
|
1297
1334
|
}
|
|
1298
1335
|
// src/host/sessions/trace.ts
|
|
1299
|
-
const KEY$
|
|
1336
|
+
const KEY$1 = "trace";
|
|
1300
1337
|
const isTrace = (value) => typeof value === "object" && value !== null && typeof value.turn === "number" && typeof value.startedAt === "number";
|
|
1301
1338
|
/** What the story kept of each turn's work, oldest first. It belongs to the story's state, so taking the story back takes the turns that no longer count with it. */
|
|
1302
1339
|
function readTraces(session) {
|
|
1303
|
-
const stored = session.metadata.getValue(KEY$
|
|
1340
|
+
const stored = session.metadata.getValue(KEY$1);
|
|
1304
1341
|
return Array.isArray(stored) ? stored.filter(isTrace) : [];
|
|
1305
1342
|
}
|
|
1306
1343
|
/** Adds to a turn's trace what one source of it knows; the sources (the characters' briefs, the scene, the log at the end of the turn) arrive at different times. */
|
|
@@ -1319,10 +1356,10 @@ function updateTrace(session, turn, patch, merge) {
|
|
|
1319
1356
|
if (at === -1) all.push(next);
|
|
1320
1357
|
else all[at] = next;
|
|
1321
1358
|
all.sort((a, b) => a.turn - b.turn);
|
|
1322
|
-
session.metadata.setValue(KEY$
|
|
1359
|
+
session.metadata.setValue(KEY$1, all.slice(-30));
|
|
1323
1360
|
}
|
|
1324
1361
|
// src/host/sessions/activity.ts
|
|
1325
|
-
const KEY
|
|
1362
|
+
const KEY = "activity";
|
|
1326
1363
|
const isEntry = (value) => {
|
|
1327
1364
|
if (typeof value !== "object" || value === null) return false;
|
|
1328
1365
|
const entry = value;
|
|
@@ -1330,13 +1367,13 @@ const isEntry = (value) => {
|
|
|
1330
1367
|
};
|
|
1331
1368
|
/** The recorded runs, oldest first. */
|
|
1332
1369
|
function readActivity(session) {
|
|
1333
|
-
const stored = session.metadata.getValue(KEY
|
|
1370
|
+
const stored = session.metadata.getValue(KEY);
|
|
1334
1371
|
return Array.isArray(stored) ? stored.filter(isEntry) : [];
|
|
1335
1372
|
}
|
|
1336
1373
|
/** Files the run and returns the runs that fell off the end of the record to make room. */
|
|
1337
1374
|
function recordActivity(session, entry) {
|
|
1338
1375
|
const all = [...readActivity(session), entry];
|
|
1339
|
-
session.metadata.setValue(KEY
|
|
1376
|
+
session.metadata.setValue(KEY, all.slice(-60));
|
|
1340
1377
|
return all.slice(0, -60);
|
|
1341
1378
|
}
|
|
1342
1379
|
const RUN_FOLDER = "activity";
|
|
@@ -1418,43 +1455,6 @@ function recordDecisions(folder, site, report, now = () => /* @__PURE__ */ new D
|
|
|
1418
1455
|
writeFileSync(aside, JSON.stringify(stats, null, 2));
|
|
1419
1456
|
renameSync(aside, target);
|
|
1420
1457
|
}
|
|
1421
|
-
// src/host/sessions/usage.ts
|
|
1422
|
-
const KEY = "usage";
|
|
1423
|
-
const isCount = (value) => typeof value === "object" && value !== null && [
|
|
1424
|
-
"input",
|
|
1425
|
-
"cached",
|
|
1426
|
-
"output"
|
|
1427
|
-
].every((field) => typeof value[field] === "number");
|
|
1428
|
-
const isUsage = (value) => typeof value === "object" && value !== null && typeof value.turn === "number" && typeof value.runs === "number" && isCount(value.master) && isCount(value.helpers);
|
|
1429
|
-
/** What each turn used, oldest first. The record belongs to the story's state, so taking the story back takes the turns that no longer count with it. */
|
|
1430
|
-
function readUsage(session) {
|
|
1431
|
-
const stored = session.metadata.getValue(KEY);
|
|
1432
|
-
return Array.isArray(stored) ? stored.filter(isUsage) : [];
|
|
1433
|
-
}
|
|
1434
|
-
/** Adds tokens to a turn's record: the game master's own, or a helper's run. */
|
|
1435
|
-
function addUsage(session, turn, who, tokens, masterMs) {
|
|
1436
|
-
const all = readUsage(session);
|
|
1437
|
-
const at = all.findIndex((entry) => entry.turn === turn);
|
|
1438
|
-
const entry = at === -1 ? {
|
|
1439
|
-
turn,
|
|
1440
|
-
master: NO_TOKENS,
|
|
1441
|
-
helpers: NO_TOKENS,
|
|
1442
|
-
runs: 0
|
|
1443
|
-
} : all[at];
|
|
1444
|
-
const next = who === "master" ? {
|
|
1445
|
-
...entry,
|
|
1446
|
-
master: addTokens(entry.master, tokens),
|
|
1447
|
-
...masterMs === void 0 ? {} : { masterMs: (entry.masterMs ?? 0) + masterMs }
|
|
1448
|
-
} : {
|
|
1449
|
-
...entry,
|
|
1450
|
-
helpers: addTokens(entry.helpers, tokens),
|
|
1451
|
-
runs: entry.runs + 1
|
|
1452
|
-
};
|
|
1453
|
-
if (at === -1) all.push(next);
|
|
1454
|
-
else all[at] = next;
|
|
1455
|
-
all.sort((a, b) => a.turn - b.turn);
|
|
1456
|
-
session.metadata.setValue(KEY, all);
|
|
1457
|
-
}
|
|
1458
1458
|
// src/host/clock/agenda.ts
|
|
1459
1459
|
const CURSOR = "agenda.cursor";
|
|
1460
1460
|
const ASKED = "agenda.asked";
|
|
@@ -2244,6 +2244,36 @@ function parseRoll(text) {
|
|
|
2244
2244
|
reason: body.slice(boundary).trim()
|
|
2245
2245
|
};
|
|
2246
2246
|
}
|
|
2247
|
+
// src/shared/wait.ts
|
|
2248
|
+
const UNITS = [
|
|
2249
|
+
[/^(?:m|min|mins|minute|minutes|分钟|分)$/iu, 1],
|
|
2250
|
+
[/^(?:h|hr|hrs|hour|hours|小时|時間|时)$/iu, 60],
|
|
2251
|
+
[/^(?:d|day|days|天|日)$/iu, 1440]
|
|
2252
|
+
];
|
|
2253
|
+
/**
|
|
2254
|
+
* The wait in a player's message (`/wait 2 hours`, `/wait 30m until the ferry`, `/wait 3天`), or nothing when the message does not start with `/wait`. The time may be missing or
|
|
2255
|
+
* unreadable, and is then `undefined` in `minutes`.
|
|
2256
|
+
*/
|
|
2257
|
+
function parseWait(text) {
|
|
2258
|
+
const value = text.trimStart();
|
|
2259
|
+
if (value.slice(0, 5).toLowerCase() !== "/wait" || value.length > 5 && !/\s/u.test(value[5])) return void 0;
|
|
2260
|
+
const body = value.slice(5).trim();
|
|
2261
|
+
const match = /^(\d+(?:\.\d+)?)\s*([\p{L}]+)\s*(.*)$/su.exec(body);
|
|
2262
|
+
if (match === null) return {
|
|
2263
|
+
minutes: void 0,
|
|
2264
|
+
reason: body
|
|
2265
|
+
};
|
|
2266
|
+
const unit = UNITS.find(([pattern]) => pattern.test(match[2]));
|
|
2267
|
+
if (unit === void 0) return {
|
|
2268
|
+
minutes: void 0,
|
|
2269
|
+
reason: body
|
|
2270
|
+
};
|
|
2271
|
+
const minutes = Math.round(Number(match[1]) * unit[1]);
|
|
2272
|
+
return {
|
|
2273
|
+
minutes: minutes >= 1 && minutes <= 525600 ? minutes : void 0,
|
|
2274
|
+
reason: match[3].trim()
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2247
2277
|
// src/host/agents/repeat-guard.ts
|
|
2248
2278
|
/**
|
|
2249
2279
|
* Keeps an agent that is stuck from making the same call again and again (found live: an assistant made one create-and-list pair 47 times in a review, a game master repeated one
|
|
@@ -2370,7 +2400,7 @@ function characterRunner(deps) {
|
|
|
2370
2400
|
signal,
|
|
2371
2401
|
sampling: childSampling(settings, "characters", answerEstimate(settings.prompts.language, request.away === true)),
|
|
2372
2402
|
...childModel(settings, "characters", named),
|
|
2373
|
-
trace: childTrace(deps.store, "characters", request.member.character.name, recalledOf(request), named),
|
|
2403
|
+
trace: childTrace(deps.store, "characters", request.member.character.name, recalledOf(request), named, request.away === true ? "off stage" : void 0),
|
|
2374
2404
|
reasoningEffort: deps.store.settings().reasoning.children,
|
|
2375
2405
|
persona: brief.persona,
|
|
2376
2406
|
prompt: brief.prompt,
|
|
@@ -3593,7 +3623,8 @@ function installHooks(ctx, deps) {
|
|
|
3593
3623
|
const text = payload.messages.filter((message) => message.source.kind === "user").flatMap((message) => message.content.flatMap((block) => block.type === "text" ? [block.text] : [])).join("\n");
|
|
3594
3624
|
if (!store.settings().background.concurrent) await engine.quiesce(owner.chat);
|
|
3595
3625
|
await ctx.roleplayOrchestration.unitFree(owner.chat);
|
|
3596
|
-
await timelines.begin(owner.chat, payload.turn, text);
|
|
3626
|
+
const began = await timelines.begin(owner.chat, payload.turn, text);
|
|
3627
|
+
deps.rolls?.begin(owner.chat, store.story.metadata.get().id, began.parent);
|
|
3597
3628
|
const cast = store.cast();
|
|
3598
3629
|
const ooc = parseOoc(text);
|
|
3599
3630
|
const command = ooc === void 0 ? /^\/([\p{L}\p{N}_]+)/u.exec(text.trim())?.[1] : void 0;
|
|
@@ -3676,7 +3707,7 @@ function installHooks(ctx, deps) {
|
|
|
3676
3707
|
if (rules.length > 0) addLine("rules", store.text("roleplay/rules", { rules: rules.map((rule) => `- ${rule}`).join("\n") }));
|
|
3677
3708
|
const wanted = ooc === void 0 ? parseRoll(text) : void 0;
|
|
3678
3709
|
if (wanted !== void 0) try {
|
|
3679
|
-
const made = rollPlain(wanted.expression);
|
|
3710
|
+
const made = rollPlain(wanted.expression, deps.rolls?.roller(owner.chat));
|
|
3680
3711
|
const roll = store.story.dice.record({
|
|
3681
3712
|
turn: payload.turn,
|
|
3682
3713
|
expression: made.expression,
|
|
@@ -3698,6 +3729,19 @@ function installHooks(ctx, deps) {
|
|
|
3698
3729
|
engine.skip(owner);
|
|
3699
3730
|
lines.push(store.text("roleplay/input-refused", { reason: error instanceof Error ? error.message : String(error) }));
|
|
3700
3731
|
}
|
|
3732
|
+
const waiting = ooc === void 0 && wanted === void 0 ? parseWait(text) : void 0;
|
|
3733
|
+
if (waiting !== void 0) {
|
|
3734
|
+
const clock = store.settings().clock;
|
|
3735
|
+
const refusal = clock.mode === "real" ? tr("this chat follows the clock on the wall, so time cannot be skipped") : waiting.minutes === void 0 ? tr("say how long, for example /wait 2 hours or /wait 30 minutes until the ferry") : waiting.minutes > clock.maxSkipDays * 1440 ? tr("that is more than the {days} days this chat allows in one skip", { days: clock.maxSkipDays }) : void 0;
|
|
3736
|
+
if (refusal !== void 0) {
|
|
3737
|
+
engine.skip(owner);
|
|
3738
|
+
lines.push(store.text("roleplay/input-refused", { reason: refusal }));
|
|
3739
|
+
} else addLine("wait", tr("The player lets {minutes} minutes pass{reason}. Move the story's time on by that much with advance_time, and let the world move meanwhile as it would: characters keep to their days, and you ask only those the time reaches. Stop sooner, at the moment it happens, if something comes up that the player must decide or could not sleep through, say what, and let the player act. Then narrate what the player perceived in the time that passed. You may play at most {rounds} rounds for this.", {
|
|
3740
|
+
minutes: waiting.minutes,
|
|
3741
|
+
reason: waiting.reason === "" ? "" : ` (${waiting.reason})`,
|
|
3742
|
+
rounds: store.settings().maxRounds
|
|
3743
|
+
}));
|
|
3744
|
+
}
|
|
3701
3745
|
if (ooc !== void 0 && ooc.request !== "") lines.push(store.text(ooc.question ? "roleplay/ask-question" : "roleplay/ooc-command", { request: ooc.request }));
|
|
3702
3746
|
if (ooc !== void 0 && ooc.request === "") {
|
|
3703
3747
|
engine.skip(owner);
|
|
@@ -3717,6 +3761,6 @@ function installHooks(ctx, deps) {
|
|
|
3717
3761
|
};
|
|
3718
3762
|
});
|
|
3719
3763
|
}
|
|
3720
|
-
export { PromptLibrary as $,
|
|
3764
|
+
export { PromptLibrary as $, answerLimits as A, PLOTS_FILE_NAME as B, readNotes as C, describeWhen as D, describeTime as E, STORY_LANGUAGES as F, commandFlagKey as G, parsePlotsFile as H, isStoryLanguage as I, Reader as J, commandsOf as K, textLanguage as L, plotProgressOf as M, populatePlots as N, zoneOf as O, LANGUAGE_NAMES as P, PROMPTS_FOLDER as Q, wrongLanguage as R, notesOfSession as S, ClockError as T, plotReferenceProblems as U, loadPlots as V, COMMANDS_KEY as W, errorMessage as X, formatIssue as Y, LANGUAGE_FOLDER as Z, readTraces as _, externalWithheld as a, shippedLanguages as at, readWithdrawn as b, record as c, AgentUnavailableError as ct, guardRepeatedCalls as d, ReflectionRefusedError as dt, copyWorldPrompts as et, MAX_OOC_ANSWER as f, SessionArchivedError as ft, readRunDetail as g, COMPARISONS as gt, readActivity as h, AUTHORING_NEEDS as ht, externalTools as i, promptProblem as it, PLOTS_METADATA_KEY as j, RESULTS as k, characterRunner as l, InvalidStartError as lt, readDecisionStats as m, WorldNotFoundError as mt, installHooks as n, languageOf as nt, PREVIEW_TOOL as o, shippedPromptsDirectory as ot, storesOf as p, SessionNotFoundError as pt, readDocument as q, externalGiven as r, listFiles as rt, createTools$1 as s, shippedText as st, externalToolLimit as t, inheritPrompts as tt, toolEnabled as u, InvalidWorldError as ut, readVerdicts as v, observeAsPlayer as w, addToNote as x, writeVerdicts as y, readUsage as z };
|
|
3721
3765
|
|
|
3722
|
-
//# sourceMappingURL=hooks-
|
|
3766
|
+
//# sourceMappingURL=hooks-BuQ61nvQ.js.map
|
package/lib/images.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-
|
|
2
|
-
import { i as updateImage, r as listGallery } from "./gallery-
|
|
3
|
-
import { c as nextSceneSerial, d as sceneImagePath, l as readImageMetadata, o as entityImageDirectory, s as inheritImages, t as addToLibrary, u as referenceImagePath, v as readPngMetadata, y as withPngMetadata } from "./library-
|
|
4
|
-
import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-
|
|
1
|
+
import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-D-WNs626.js";
|
|
2
|
+
import { i as updateImage, r as listGallery } from "./gallery-CtG-bDzz.js";
|
|
3
|
+
import { c as nextSceneSerial, d as sceneImagePath, l as readImageMetadata, o as entityImageDirectory, s as inheritImages, t as addToLibrary, u as referenceImagePath, v as readPngMetadata, y as withPngMetadata } from "./library-CH-ahlm0.js";
|
|
4
|
+
import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
|
|
5
5
|
export { addToLibrary, entityImageDirectory, generateReferenceImage, generateTransientImage, imageTools, inheritImages, interpretImage, listGallery, nextSceneSerial, present, presentedFor, readImageMetadata, readPngMetadata, referenceImagePath, referencePrompt, runImagePresenter, sceneImagePath, searchImages, tokensOf, transientPrompt, updateImage, withPngMetadata };
|