@dsh-agentic-roleplay/core 0.12.7 → 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-Bi9YQ9QH.js → authoring-tools-CKV1UnN7.js} +1089 -129
- package/lib/authoring.js +130 -37
- package/lib/client.js +1251 -662
- package/lib/client.js.map +1 -1
- package/lib/doctor.js +1 -1
- package/lib/{gallery-BT5lf-T5.js → gallery-CT5uj50b.js} +2 -2
- package/lib/{hooks-DR-HqE50.js → hooks-CnxV2uEh.js} +43 -16
- package/lib/images.js +3 -3
- package/lib/index.js +336 -15
- package/lib/{interpreter-BYNrjYZo.js → interpreter-Cz5qsuXk.js} +3 -3
- package/lib/{lorebook-author-tools-BI-r8fEt.js → lorebook-author-tools-p3Nfpuxh.js} +6 -6
- package/lib/lorebook-authoring.js +5 -5
- package/lib/orchestration.js +15 -10
- package/lib/{pack-jail-Y1XPbqHw.js → pack-jail-KyZen_gy.js} +9 -9
- package/lib/{packs-DD-v-Epl.js → packs-DU171pDX.js} +2 -2
- package/lib/{presenter-agent-00sOVGI9.js → presenter-agent-CwDg0WE8.js} +2 -2
- package/lib/{preset-Bnx3jhUv.js → preset-BO8iWQ-n.js} +3 -3
- package/lib/{preset-author-tools-DYrBcieA.js → preset-author-tools-C83shASm.js} +6 -6
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-DqxoV9xE.js → reflection-CXS87Di3.js} +6 -6
- package/lib/{serial-CS46qAvI.js → serial-xcAG57p_.js} +148 -38
- package/lib/{text-B-HsLdb-.js → text-KnqhN_Zv.js} +4 -1
- package/lib/{turn-guard-bZkxzRXJ.js → turn-guard-CfsGepCg.js} +2 -2
- package/package.json +2 -2
- 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/world/procedure.md +3 -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/world/procedure.md +3 -0
|
@@ -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
|
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-
|
|
5
|
+
import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-CXS87Di3.js";
|
|
6
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-
|
|
8
|
-
import {
|
|
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 { D as uniqueKey, T as slug, a as updateImage, i as listGallery, n as describeGalleryImage, o as addToLibrary } from "./gallery-
|
|
12
|
-
import { _ as API_PREFIX } from "./packs-
|
|
13
|
-
import { t as runImagePresenter } from "./presenter-agent-
|
|
14
|
-
import { c as presentedFor, i as findImages, n as interpretImage, s as present } from "./interpreter-
|
|
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";
|
|
@@ -4462,9 +4462,14 @@ var ImageJobs = class {
|
|
|
4462
4462
|
const attachments = this.deps.attachments?.();
|
|
4463
4463
|
const parent = this.deps.agentOf(chatSessionId(id));
|
|
4464
4464
|
const settings = this.deps.settings(id);
|
|
4465
|
-
if (attachments === void 0 || parent === void 0) return;
|
|
4466
4465
|
const folder = sessionFolder(this.deps.sessionsDir(), id);
|
|
4467
|
-
|
|
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) {
|
|
4468
4473
|
if (signal.aborted) return;
|
|
4469
4474
|
try {
|
|
4470
4475
|
await (this.deps.interpret ?? interpretImage)({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { A as chatSessionId } from "./child-Bfj7-Iuo.js";
|
|
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-
|
|
3
|
-
import {
|
|
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
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 { C as mapLimit, m as referenceImagePath, v as readImageFileMetadata } from "./gallery-
|
|
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 { l as generateReferenceImage, p as uploadReferenceImage } from "./interpreter-
|
|
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";
|
|
@@ -3233,4 +3233,4 @@ function registerPackJail(ctx, deps) {
|
|
|
3233
3233
|
}
|
|
3234
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 };
|
|
3235
3235
|
|
|
3236
|
-
//# 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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
2
2
|
import { l as runChild } from "./child-Bfj7-Iuo.js";
|
|
3
|
-
import { r as imageTools, t as canReadImages } from "./interpreter-
|
|
3
|
+
import { r as imageTools, t as canReadImages } from "./interpreter-Cz5qsuXk.js";
|
|
4
4
|
// src/host/images/presenter-agent.ts
|
|
5
5
|
const RESULT = {
|
|
6
6
|
type: "object",
|
|
@@ -56,4 +56,4 @@ async function runImagePresenter(job) {
|
|
|
56
56
|
}
|
|
57
57
|
export { runImagePresenter as t };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=presenter-agent-
|
|
59
|
+
//# sourceMappingURL=presenter-agent-CwDg0WE8.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Gt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-
|
|
1
|
+
import { Gt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-CKV1UnN7.js";
|
|
2
2
|
import { p as SAMPLING_RANGES } from "./child-Bfj7-Iuo.js";
|
|
3
|
-
import {
|
|
3
|
+
import { jt as cleanText } from "./serial-xcAG57p_.js";
|
|
4
4
|
// src/host/import/preset.ts
|
|
5
5
|
/** The older preset layout keeps its texts under fixed keys. */
|
|
6
6
|
const LEGACY_KEYS = [
|
|
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
|
|
|
239
239
|
}
|
|
240
240
|
export { readPreset as n, selectPrompts as r, previewPreset as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=preset-
|
|
242
|
+
//# sourceMappingURL=preset-BO8iWQ-n.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-5vtPAT3O.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import { o as contextOf } from "./authoring-tools-
|
|
5
|
-
import { i as translator, r as languageOf } from "./text-
|
|
6
|
-
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-
|
|
2
|
+
import { Ft as IMPORT_FOLDER, Pt as withPlayer, Z as PRESET_FILE, at as readPreset, dt as deleteWorldPrompt, f as extractStyleFrom, ft as listWorldPrompts, it as presetDirectory, lt as updatePresetInfo, mt as writeWorldPrompt, pt as readWorldPrompt, ut as PROSE_PROMPTS } from "./serial-xcAG57p_.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-BO8iWQ-n.js";
|
|
4
|
+
import { o as contextOf } from "./authoring-tools-CKV1UnN7.js";
|
|
5
|
+
import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
|
|
6
|
+
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-CnxV2uEh.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -279,4 +279,4 @@ async function presetApproval(exec, next, carries, auto = () => false) {
|
|
|
279
279
|
}
|
|
280
280
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
281
281
|
|
|
282
|
-
//# sourceMappingURL=preset-author-tools-
|
|
282
|
+
//# sourceMappingURL=preset-author-tools-C83shASm.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -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 { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-
|
|
5
|
-
import "./hooks-
|
|
6
|
-
import {
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-C83shASm.js";
|
|
5
|
+
import "./hooks-CnxV2uEh.js";
|
|
6
|
+
import { it as presetDirectory } from "./serial-xcAG57p_.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
// src/preset-authoring.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-Bfj7-Iuo.js";
|
|
2
|
-
import {
|
|
2
|
+
import { B as yesAt, F as askYesNo, I as mergeReports, P as announceProblem, R as noAt, ct as sha, nt as listPresets, rt as loadPreset, t as SerialQueue, z as routeVerdicts } from "./serial-xcAG57p_.js";
|
|
3
3
|
import { i as wordsOf } from "./narration-CUZIXzab.js";
|
|
4
4
|
import { t as promptFor } from "./access-5vtPAT3O.js";
|
|
5
|
-
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-
|
|
6
|
-
import { i as translator, r as languageOf } from "./text-
|
|
7
|
-
import { d as inheritImages } from "./gallery-
|
|
8
|
-
import { i as inheritPacks } from "./packs-
|
|
5
|
+
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-CnxV2uEh.js";
|
|
6
|
+
import { i as translator, r as languageOf } from "./text-KnqhN_Zv.js";
|
|
7
|
+
import { d as inheritImages } from "./gallery-CT5uj50b.js";
|
|
8
|
+
import { i as inheritPacks } from "./packs-DU171pDX.js";
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
10
10
|
import { characterKey, locationKey, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
11
11
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -1505,4 +1505,4 @@ function memoryReflector(deps) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
export { pathTo as _, whereabouts as a, BranchError as c, recordPreset as d, switchPreset as f, childrenOf as g, START_SNAPSHOT as h, reflectionStatus as i, copyPreset as l, writeTimeline as m, memoryReflector as n, TimelineError as o, readTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, presetStatus as u, snapshotOf as v };
|
|
1507
1507
|
|
|
1508
|
-
//# sourceMappingURL=reflection-
|
|
1508
|
+
//# sourceMappingURL=reflection-CXS87Di3.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { m as parseSampling } from "./child-Bfj7-Iuo.js";
|
|
2
2
|
import { p as parseSwitchboard } from "./narration-CUZIXzab.js";
|
|
3
3
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-5vtPAT3O.js";
|
|
4
|
-
import { G as readDocument, J as
|
|
5
|
-
import { i as translator, r as languageOf$1 } from "./text-
|
|
6
|
-
import { C as mapLimit, D as uniqueKey, E as trOf, T as slug, w as norm } from "./gallery-
|
|
4
|
+
import { G as readDocument, J as formatIssue, K as errorMessage, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as Reader, rt as promptProblem, tt as languageOf } from "./hooks-CnxV2uEh.js";
|
|
5
|
+
import { i as translator, r as languageOf$1 } from "./text-KnqhN_Zv.js";
|
|
6
|
+
import { C as mapLimit, D as uniqueKey, E as trOf, T as slug, w as norm } from "./gallery-CT5uj50b.js";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, isTimeZone, parseInstant, valueIssue } from "@dsh-agentic-roleplay/state";
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
@@ -1352,6 +1352,13 @@ function findPanel(text) {
|
|
|
1352
1352
|
for (const line of text.split("\n")) for (const sentence of sentencesOf(line)) if (OUTPUT_MARKUP.test(sentence) || BARRED.test(sentence) && /\d/.test(sentence)) return sentence.trim();
|
|
1353
1353
|
}
|
|
1354
1354
|
// src/shared/import-card.ts
|
|
1355
|
+
const IMPORT_PAUSES = [
|
|
1356
|
+
"never",
|
|
1357
|
+
"survey",
|
|
1358
|
+
"stages"
|
|
1359
|
+
];
|
|
1360
|
+
/** What the pause is for a card: the choice, or the default for its size. */
|
|
1361
|
+
const pauseOf = (choices, entries) => choices.pause ?? (entries >= 30 ? "stages" : "never");
|
|
1355
1362
|
/** The command that imports the card waiting in a world, in the world's authoring chat. */
|
|
1356
1363
|
const IMPORT_COMMAND = "/import-st";
|
|
1357
1364
|
/** What follows the command's name: the card it names, then what the person asks for. The card is always the one in the world's import folder; only the request is passed on. */
|
|
@@ -1917,7 +1924,8 @@ function defaultChoices(card) {
|
|
|
1917
1924
|
return {
|
|
1918
1925
|
name: card.name.slice(0, 200),
|
|
1919
1926
|
disabledEntries: (card.book?.entries ?? []).filter((entry) => !entry.enabled).map((entry) => entry.id),
|
|
1920
|
-
opening
|
|
1927
|
+
opening,
|
|
1928
|
+
pause: pauseOf({}, (card.book?.entries ?? []).length)
|
|
1921
1929
|
};
|
|
1922
1930
|
}
|
|
1923
1931
|
/** The text of the opening a choice names; nothing when the choice is none or names nothing. */
|
|
@@ -1951,12 +1959,14 @@ function parseChoices(value) {
|
|
|
1951
1959
|
};
|
|
1952
1960
|
else if (raw?.["kind"] !== "none") problems.push("opening must be first, alternate with an index, or none");
|
|
1953
1961
|
if (input["fetchPictures"] !== void 0 && typeof input["fetchPictures"] !== "boolean") problems.push("fetchPictures must be true or false");
|
|
1962
|
+
if (input["pause"] !== void 0 && !IMPORT_PAUSES.includes(input["pause"])) problems.push(`pause must be one of ${IMPORT_PAUSES.join(", ")}`);
|
|
1954
1963
|
if (problems.length > 0) throw new InvalidEditProblems(problems);
|
|
1955
1964
|
return {
|
|
1956
1965
|
name,
|
|
1957
1966
|
disabledEntries: [...new Set(disabled)],
|
|
1958
1967
|
opening,
|
|
1959
|
-
...input["fetchPictures"] === false ? { fetchPictures: false } : {}
|
|
1968
|
+
...input["fetchPictures"] === false ? { fetchPictures: false } : {},
|
|
1969
|
+
...input["pause"] === void 0 ? {} : { pause: input["pause"] }
|
|
1960
1970
|
};
|
|
1961
1971
|
}
|
|
1962
1972
|
async function readJson(file) {
|
|
@@ -3542,6 +3552,12 @@ const ROLES = [
|
|
|
3542
3552
|
"template",
|
|
3543
3553
|
"irrelevant"
|
|
3544
3554
|
];
|
|
3555
|
+
const KINDS = [
|
|
3556
|
+
"character",
|
|
3557
|
+
"place",
|
|
3558
|
+
"faction",
|
|
3559
|
+
"thing"
|
|
3560
|
+
];
|
|
3545
3561
|
/** One place that says what every role means to the import; the stages ask the predicates below instead of listing roles. */
|
|
3546
3562
|
const ROLE_TABLE = {
|
|
3547
3563
|
character: {
|
|
@@ -3601,6 +3617,7 @@ const ROLE_TABLE = {
|
|
|
3601
3617
|
};
|
|
3602
3618
|
/** The role a piece is mostly about: the first the classifier named. */
|
|
3603
3619
|
const mainRole = (piece) => piece.roles[0];
|
|
3620
|
+
const kindOfRole = (role) => ROLE_TABLE[role].entity;
|
|
3604
3621
|
const playsRole = (piece, role) => piece.roles.includes(role);
|
|
3605
3622
|
const isLeftOut = (piece) => piece.roles.every((role) => ROLE_TABLE[role].leftOut);
|
|
3606
3623
|
/** A piece that is only guidance on making people, places or things up while the story is played: the names in it are kinds and examples, not entities of the world. */
|
|
@@ -3982,6 +3999,40 @@ function findEntity(roster, name, kind) {
|
|
|
3982
3999
|
}));
|
|
3983
4000
|
return near.length === 1 ? near[0] : void 0;
|
|
3984
4001
|
}
|
|
4002
|
+
// src/host/import/passages.ts
|
|
4003
|
+
/** Finding a model's copy of a passage in the text it was copied from. */
|
|
4004
|
+
const squeezed = (text) => text.replace(/\s+/g, " ").trim();
|
|
4005
|
+
/** The letters and digits of a text, folded, each with where it stands in the text: two copies of a passage that differ only in spacing, quotes, markup or punctuation have the same ones. */
|
|
4006
|
+
function lettersOf(text) {
|
|
4007
|
+
let letters = "";
|
|
4008
|
+
const at = [];
|
|
4009
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
4010
|
+
const char = text[index];
|
|
4011
|
+
if (!/[\p{L}\p{N}]/u.test(char)) continue;
|
|
4012
|
+
const folded = char.normalize("NFKC").toLowerCase();
|
|
4013
|
+
for (let part = 0; part < folded.length; part += 1) {
|
|
4014
|
+
letters += folded[part];
|
|
4015
|
+
at.push(index);
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
return {
|
|
4019
|
+
letters,
|
|
4020
|
+
at
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
4023
|
+
/** The fewest letters a passage must have to be found by its letters alone: a shorter one could be anywhere. */
|
|
4024
|
+
const MIN_SNAP_LETTERS = 12;
|
|
4025
|
+
/** A passage as the piece has it: the passage itself when the piece holds it (whatever its spacing), else the stretch of the piece with the same letters in the same order, else nothing. */
|
|
4026
|
+
function snapPassage(passage, source) {
|
|
4027
|
+
if (squeezed(passage) === "") return void 0;
|
|
4028
|
+
if (squeezed(source).includes(squeezed(passage))) return passage;
|
|
4029
|
+
const wanted = lettersOf(passage).letters;
|
|
4030
|
+
if (wanted.length < MIN_SNAP_LETTERS) return void 0;
|
|
4031
|
+
const whole = lettersOf(source);
|
|
4032
|
+
const found = whole.letters.indexOf(wanted);
|
|
4033
|
+
if (found < 0) return void 0;
|
|
4034
|
+
return source.slice(whole.at[found], whole.at[found + wanted.length - 1] + 1);
|
|
4035
|
+
}
|
|
3985
4036
|
// src/host/import/extract.ts
|
|
3986
4037
|
const emptyExtracted = () => ({
|
|
3987
4038
|
characters: [],
|
|
@@ -4467,12 +4518,10 @@ const MIN_GUIDANCE_CHARS = 120;
|
|
|
4467
4518
|
/** The most characters of standing rules the game master carries on every turn; the rest of what the card always sends is found by search like any lore. */
|
|
4468
4519
|
const STANDING_MAX_CHARS = 12e3;
|
|
4469
4520
|
const STANDING_PROMPT = "roleplay/standing";
|
|
4470
|
-
|
|
4471
|
-
/** Why the passages cannot be used, or nothing when each is in the piece word for word: the guidance is the card's, and a rewrite would be the model's. */
|
|
4521
|
+
/** Why the passages cannot be used, or nothing when each is in the piece word for word, or differs from it only in spacing, quotes and markup: the guidance is the card's, and a rewrite would be the model's. */
|
|
4472
4522
|
function passageProblem(answer, source) {
|
|
4473
|
-
const whole = squeezed(source);
|
|
4474
4523
|
for (const field of ["casting", "rules"]) {
|
|
4475
|
-
const missing = (Array.isArray(answer[field]) ? answer[field] : []).findIndex((passage) => typeof passage !== "string" ||
|
|
4524
|
+
const missing = (Array.isArray(answer[field]) ? answer[field] : []).findIndex((passage) => typeof passage !== "string" || snapPassage(passage, source) === void 0);
|
|
4476
4525
|
if (missing >= 0) return `${field} passage ${missing + 1} is not in the piece word for word: copy it exactly as written, or leave it out`;
|
|
4477
4526
|
}
|
|
4478
4527
|
}
|
|
@@ -4487,7 +4536,6 @@ function guidanceEntry(passages, title) {
|
|
|
4487
4536
|
body
|
|
4488
4537
|
};
|
|
4489
4538
|
}
|
|
4490
|
-
/** What a prompt file cannot hold is changed so that `${` and `{{` in a card's text are not read as variables. */
|
|
4491
4539
|
const inert = (text) => text.replace(/\$\{/g, "$ {").replace(/\{\{/g, "{ {");
|
|
4492
4540
|
const LORE_SCHEMA = {
|
|
4493
4541
|
type: "object",
|
|
@@ -4598,6 +4646,8 @@ function asWritten(item) {
|
|
|
4598
4646
|
/** The entries of a piece must hold at least this share of its text, from a piece of at least `MIN_CHECKED_CHARS` characters: the facts are kept, not summarised away. */
|
|
4599
4647
|
const MIN_LORE_SHARE = .5;
|
|
4600
4648
|
const MIN_CHECKED_CHARS = 300;
|
|
4649
|
+
/** How often a model that writes unusable entries for a piece is told before the piece goes in as the card wrote it. */
|
|
4650
|
+
const LORE_REFUSALS = 2;
|
|
4601
4651
|
/** Why the entries made of a piece cannot be used, or nothing when they can. */
|
|
4602
4652
|
function loreProblem(answer, roster, source) {
|
|
4603
4653
|
const entries = loreDocuments(answer, roster, /* @__PURE__ */ new Set());
|
|
@@ -4863,11 +4913,17 @@ async function startingPlaces(ctx, card, items, classified, roster, results) {
|
|
|
4863
4913
|
}
|
|
4864
4914
|
return made;
|
|
4865
4915
|
}
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4916
|
+
const GROUPS = {
|
|
4917
|
+
character: "characters",
|
|
4918
|
+
place: "locations",
|
|
4919
|
+
faction: "factions",
|
|
4920
|
+
thing: "items"
|
|
4921
|
+
};
|
|
4922
|
+
/** Writes the document of every entity of one kind, one job each. A job that fails leaves a note instead of the entity. */
|
|
4923
|
+
async function writeEntities(ctx, card, items, classified, roster, kind) {
|
|
4924
|
+
const mine = roster.filter((entity) => entity.kind === kind);
|
|
4925
|
+
return await mapLimit(mine, ctx.concurrency, async (entity, index) => {
|
|
4926
|
+
ctx.say(`writing ${entity.kind} ${index + 1}/${mine.length}: ${entity.name}`);
|
|
4871
4927
|
const sources = sourcesFor(entity, items, classified);
|
|
4872
4928
|
try {
|
|
4873
4929
|
const answer = await ctx.run(jobFor(ctx.text, trOf(ctx), entity, sources, roster, card));
|
|
@@ -4887,23 +4943,38 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
4887
4943
|
};
|
|
4888
4944
|
}
|
|
4889
4945
|
});
|
|
4890
|
-
|
|
4891
|
-
|
|
4946
|
+
}
|
|
4947
|
+
function collect(result, written) {
|
|
4948
|
+
for (const { entity, built, failure } of written) {
|
|
4892
4949
|
if (failure !== void 0 || built === void 0) {
|
|
4893
4950
|
result.notes.push(failure ?? `${entity.name}: nothing was written`);
|
|
4894
4951
|
continue;
|
|
4895
4952
|
}
|
|
4896
4953
|
result.notes.push(...built.notes);
|
|
4897
4954
|
if (entity.kind === "thing" && built.document["held_by"] === void 0 && built.document["location"] === void 0) continue;
|
|
4898
|
-
result[
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4955
|
+
result[GROUPS[entity.kind]].push(built.document);
|
|
4956
|
+
}
|
|
4957
|
+
return result;
|
|
4958
|
+
}
|
|
4959
|
+
/** The places of the roster. */
|
|
4960
|
+
async function extractPlaces(ctx, card, items, classified, roster) {
|
|
4961
|
+
return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "place"));
|
|
4962
|
+
}
|
|
4963
|
+
/** The organisations of the roster. */
|
|
4964
|
+
async function extractFactions(ctx, card, items, classified, roster) {
|
|
4965
|
+
return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "faction"));
|
|
4966
|
+
}
|
|
4967
|
+
/** The things of the roster (one nobody holds or keeps anywhere is left out). */
|
|
4968
|
+
async function extractThings(ctx, card, items, classified, roster) {
|
|
4969
|
+
return collect(emptyExtracted(), await writeEntities(ctx, card, items, classified, roster, "thing"));
|
|
4970
|
+
}
|
|
4971
|
+
/** The characters of the roster, the places their starts name that the roster lacks, and what each has on them that the roster does not list as a thing. */
|
|
4972
|
+
async function extractCharacters(ctx, card, items, classified, roster) {
|
|
4973
|
+
const written = await writeEntities(ctx, card, items, classified, roster, "character");
|
|
4974
|
+
written.push(...await startingPlaces(ctx, card, items, classified, roster, written));
|
|
4975
|
+
const result = collect(emptyExtracted(), written);
|
|
4976
|
+
const itemIds = new Set(roster.filter((entity) => entity.kind === "thing").map((entity) => entity.key));
|
|
4977
|
+
for (const { entity, built } of written) {
|
|
4907
4978
|
if (entity.kind !== "character") continue;
|
|
4908
4979
|
for (const name of built?.carried ?? []) {
|
|
4909
4980
|
if (findEntity(roster, name, "thing") !== void 0 || result.items.some((entry) => norm(String(entry["name"])) === norm(name) && entry["held_by"] === entity.key)) continue;
|
|
@@ -4914,22 +4985,40 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
4914
4985
|
});
|
|
4915
4986
|
}
|
|
4916
4987
|
}
|
|
4988
|
+
return result;
|
|
4989
|
+
}
|
|
4990
|
+
/** The background of the world: lore from the pieces about it, what a generator piece says, and the passages that lay down rules or how people are made up. */
|
|
4991
|
+
async function extractBackground(ctx, card, items, classified, roster) {
|
|
4992
|
+
const result = emptyExtracted();
|
|
4917
4993
|
const worldItems = items.filter((item) => statesWorldFacts(classified[item.id] ?? { roles: [] }));
|
|
4918
4994
|
const taken = /* @__PURE__ */ new Set();
|
|
4919
4995
|
const loreResults = await mapLimit(worldItems, ctx.concurrency, async (item, index) => {
|
|
4920
4996
|
ctx.say(`writing background ${index + 1}/${worldItems.length}: ${item.label}`);
|
|
4921
4997
|
try {
|
|
4922
4998
|
const tr = trOf(ctx);
|
|
4999
|
+
let refusals = 0;
|
|
4923
5000
|
const prompt = `${tr("Card: {name}", { name: card.name })}\n${tr("Piece: {label}", { label: item.label })}${item.title === "" ? "" : `\n${tr("Title: {title}", { title: item.title })}`}\n\n${tr("The entities of this world, which are the only ones the entries may name as subjects:")}\n${rosterLines(roster, tr)}\n\n${tr("Source piece:")}\n${item.text.slice(0, 5500)}`;
|
|
5001
|
+
const answer = await ctx.run({
|
|
5002
|
+
persona: ctx.text("import/lore", { rules: ctx.text("import/common-rules") }),
|
|
5003
|
+
maxTokens: 1500 + item.text.length,
|
|
5004
|
+
prompt,
|
|
5005
|
+
result: LORE_SCHEMA,
|
|
5006
|
+
check: (value) => {
|
|
5007
|
+
const problem = loreProblem(value, roster, item.text);
|
|
5008
|
+
if (problem === void 0 || refusals >= LORE_REFUSALS) return void 0;
|
|
5009
|
+
refusals += 1;
|
|
5010
|
+
return problem;
|
|
5011
|
+
}
|
|
5012
|
+
});
|
|
5013
|
+
const still = loreProblem(answer, roster, item.text);
|
|
5014
|
+
if (still !== void 0) return {
|
|
5015
|
+
item,
|
|
5016
|
+
answer: asWritten(item),
|
|
5017
|
+
failure: `${item.label}: kept as the card wrote it, because the model's entries were not usable (${still})`
|
|
5018
|
+
};
|
|
4924
5019
|
return {
|
|
4925
5020
|
item,
|
|
4926
|
-
answer
|
|
4927
|
-
persona: ctx.text("import/lore", { rules: ctx.text("import/common-rules") }),
|
|
4928
|
-
maxTokens: 1500 + item.text.length,
|
|
4929
|
-
prompt,
|
|
4930
|
-
result: LORE_SCHEMA,
|
|
4931
|
-
check: (value) => loreProblem(value, roster, item.text)
|
|
4932
|
-
})
|
|
5021
|
+
answer
|
|
4933
5022
|
};
|
|
4934
5023
|
} catch (error) {
|
|
4935
5024
|
return {
|
|
@@ -4961,18 +5050,26 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
4961
5050
|
ctx.say(`looking for guidance on making things up and for standing rules ${index + 1}/${searched.length}: ${item.label}`);
|
|
4962
5051
|
try {
|
|
4963
5052
|
const prompt = `${tr("Card: {name}", { name: card.name })}\n${tr("Piece: {label}", { label: item.label })}\n\n${tr("Source piece:")}\n${item.text.slice(0, 5500)}`;
|
|
5053
|
+
let refused = false;
|
|
4964
5054
|
const answer = await ctx.run({
|
|
4965
5055
|
persona: ctx.text("import/generator", { rules: ctx.text("import/common-rules") }),
|
|
4966
5056
|
maxTokens: 600 + item.text.length,
|
|
4967
5057
|
prompt,
|
|
4968
5058
|
result: GUIDANCE_SCHEMA,
|
|
4969
|
-
check: (value) =>
|
|
5059
|
+
check: (value) => {
|
|
5060
|
+
const problem = passageProblem(value, item.text);
|
|
5061
|
+
if (problem === void 0 || refused) return void 0;
|
|
5062
|
+
refused = true;
|
|
5063
|
+
return problem;
|
|
5064
|
+
}
|
|
4970
5065
|
});
|
|
4971
|
-
const passages = (field) => answer[field].map(withoutOutputMarkup).filter((passage) => passage.trim() !== "");
|
|
5066
|
+
const passages = (field) => answer[field].map((passage) => snapPassage(passage, item.text)).filter((passage) => passage !== void 0).map(withoutOutputMarkup).filter((passage) => passage.trim() !== "");
|
|
5067
|
+
const lost = answer["casting"].length + answer["rules"].length - passages("casting").length - passages("rules").length;
|
|
4972
5068
|
return {
|
|
4973
5069
|
item,
|
|
4974
5070
|
casting: passages("casting"),
|
|
4975
|
-
rules: passages("rules")
|
|
5071
|
+
rules: passages("rules"),
|
|
5072
|
+
...lost > 0 ? { failure: `${item.label}: ${lost} passage${lost === 1 ? " was" : "s were"} not in the piece word for word and left out` } : {}
|
|
4976
5073
|
};
|
|
4977
5074
|
} catch (error) {
|
|
4978
5075
|
return {
|
|
@@ -5014,6 +5111,19 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
5014
5111
|
id: STANDING_PROMPT,
|
|
5015
5112
|
text: inert(standing)
|
|
5016
5113
|
});
|
|
5114
|
+
return result;
|
|
5115
|
+
}
|
|
5116
|
+
/** The documents of several stages as one: what each made, in the order given. */
|
|
5117
|
+
function mergeExtracted(parts) {
|
|
5118
|
+
const merged = emptyExtracted();
|
|
5119
|
+
for (const part of parts) for (const key of Object.keys(merged)) {
|
|
5120
|
+
const more = part[key];
|
|
5121
|
+
if (more !== void 0) merged[key].push(...more);
|
|
5122
|
+
}
|
|
5123
|
+
return merged;
|
|
5124
|
+
}
|
|
5125
|
+
/** What is left to do once every stage has written its documents: places for characters that start nowhere, links and knowledge that name what does not exist, awareness a relationship implies. */
|
|
5126
|
+
function settleExtracted(result, items, classified, roster) {
|
|
5017
5127
|
placeAtScenario(result, items, classified, roster);
|
|
5018
5128
|
pruneLoreSubjects(result);
|
|
5019
5129
|
pruneMembers(result);
|
|
@@ -5413,6 +5523,6 @@ var SerialQueue = class {
|
|
|
5413
5523
|
return this.tails.size;
|
|
5414
5524
|
}
|
|
5415
5525
|
};
|
|
5416
|
-
export {
|
|
5526
|
+
export { createPresetFromShipped as $, findPanel as $t, ROLES as A, subfolders as At, yesAt as B, parseChoices as Bt, settleExtracted as C, DEFAULT_SLOTS as Cn, lorebookDirectory as Ct, classifyItems as D, writeLorebookEntry as Dt, buildRoster as E, updateLorebookInfo as Et, askYesNo as F, IMPORT_FOLDER as Ft, hasSpeech as G, parseFactionEdit as Gt, parseWorldFile as H, writeChoices as Ht, mergeReports as I, ImportNotFoundError as It, combineAnswers as J, parseRelationEdit as Jt, parseOpeningParts as K, parseLoreEdit as Kt, modeFor as L, ImportStore as Lt, isLeftOut as M, itemise as Mt, kindOfRole as N, partsOf as Nt, findEntity as O, LORE_DIR as Ot, announceProblem as P, withPlayer as Pt, createPresetFromGuidance as Q, pauseOf as Qt, noAt as R, PICTURE_FILE as Rt, pruneRelationships as S, WEEKDAY_NAMES as Sn, loadLorebook as St, snapPassage as T, reserveLorebook as Tt, MAX_OPENING_CHARS as U, InvalidEditProblems as Ut, WORLD_FILE_NAME as V, readImportFolder as Vt, parseWorldInfoEdit as W, parseCharacterEdit as Wt, startQuestionsToFile as X, IMPORT_COMMAND as Xt, questionView as Y, parseThingEdit as Yt, PRESET_FILE as Z, importRequestOf as Zt, mergeExtracted as _, CHARACTER_FILE_NAME as _n, deleteLorebook as _t, characterDocument as a, parseVariablesFile as an, readPreset as at, pruneLoreSubjects as b, LORE_KINDS as bn, isLorebookName as bt, extractCharacters as c, parseLoreFile as cn, sha as ct, extractStyle as d, ITEM_FILE_NAME as dn, deleteWorldPrompt as dt, splitPanels as en, deletePreset as et, extractStyleFrom as f, SLOTS_FILE_NAME as fn, listWorldPrompts as ft, loreDocuments as g, parseFactionFile as gn, createLorebook as gt, inert as h, FACTION_FILE_NAME as hn, addLorebookEntries as ht, asWritten as i, loadVariables as in, presetDirectory as it, ROLE_TABLE as j, cleanText as jt, KINDS as k, loadLore as kt, extractFactions as l, LOCATION_FILE_NAME as ln, updatePresetInfo as lt, extractVariables as m, parseSlotsFile as mn, writeWorldPrompt as mt, STANDING_PROMPT as n, sourceSummary as nn, listPresets as nt, emptyExtracted as o, variableProblems as on, reservePreset as ot, extractThings as p, parseItemFile as pn, readWorldPrompt as pt, partsText as q, parsePlaceEdit as qt, addLore as r, VARIABLES_FILE_NAME as rn, loadPreset as rt, extractBackground as s, LORE_FILE_NAME as sn, savePresetFromWorld as st, SerialQueue as t, dialectOf as tn, isPresetName as tt, extractPlaces as u, parseLocationFile as un, PROSE_PROMPTS as ut, pruneKnowledge as v, parseCharacterFile as vn, deleteLorebookEntry as vt, sourcesFor as w, INTENT_STATUSES as wn, readLorebook as wt, pruneMembers as x, LORE_SCOPES as xn, listLorebooks as xt, pruneLinks as y, guarded as yn, entriesOf as yt, routeVerdicts as z, openingText as zt };
|
|
5417
5527
|
|
|
5418
|
-
//# sourceMappingURL=serial-
|
|
5528
|
+
//# sourceMappingURL=serial-xcAG57p_.js.map
|
|
@@ -264,6 +264,9 @@ const ZH = {
|
|
|
264
264
|
"(none: write only what the name itself implies, and leave the rest empty)": "(无:只写名字本身能推出的内容,其余留空)",
|
|
265
265
|
"The entities of this world, which are the only ones the entries may name as subjects:": "这个世界里的对象,条目只能以它们作为主题:",
|
|
266
266
|
"Source piece:": "来源片段:",
|
|
267
|
+
"`{tool}` failed {count} times in a row in this turn, with different arguments each time, so guessing more will not work. Do not call it again this turn: use another tool to find what you need (a search or an overview), or finish and say what is left.": "`{tool}` 在本回合内已连续失败 {count} 次,每次参数都不同,继续猜测不会奏效。本回合不要再调用它:改用别的工具(搜索或总览)查找所需内容,或者结束并说明还剩什么。",
|
|
268
|
+
"A note from the person importing the card, for this step. Follow it where the card allows; it never overrides the rules above:": "导入卡片的用户为这一步写的要求。卡片允许的范围内请照做;它不会覆盖上面的规则:",
|
|
269
|
+
"The person restored this world to the checkpoint \"{label}\" ({at}): every file is as it was then, and what you edited since is gone. Read the world again before you edit, and do not rely on what you remember of it.": "用户已把这个世界还原到检查点“{label}”({at}):每个文件都恢复为当时的内容,你此后所做的编辑已不复存在。编辑之前请重新读取世界,不要依赖你记得的内容。",
|
|
267
270
|
"This exact call was already made {count} times in this turn with the same result. Do not repeat it: go on with the next step, or finish and say what is left.": "这个完全相同的调用在本回合内已经执行了 {count} 次,结果相同。不要再重复:继续下一步,或者结束并说明还剩什么。",
|
|
268
271
|
"{label}: how people are made up": "{label}:人物如何生成",
|
|
269
272
|
"{label}: rules and mechanics": "{label}:规则与机制",
|
|
@@ -348,4 +351,4 @@ function withoutExtension(value) {
|
|
|
348
351
|
}
|
|
349
352
|
export { translator as i, withoutExtension as n, languageOf as r, trimCharacters as t };
|
|
350
353
|
|
|
351
|
-
//# sourceMappingURL=text-
|
|
354
|
+
//# sourceMappingURL=text-KnqhN_Zv.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as finishOf, E as cutOff } from "./child-Bfj7-Iuo.js";
|
|
2
|
-
import { r as guardRepeatedCalls } from "./hooks-
|
|
2
|
+
import { r as guardRepeatedCalls } from "./hooks-CnxV2uEh.js";
|
|
3
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
// src/host/authoring/turn-guard.ts
|
|
5
5
|
/**
|
|
@@ -49,4 +49,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
|
49
49
|
}
|
|
50
50
|
export { guardAuthoringTurns as t };
|
|
51
51
|
|
|
52
|
-
//# sourceMappingURL=turn-guard-
|
|
52
|
+
//# sourceMappingURL=turn-guard-CfsGepCg.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Core plugin of the agentic roleplay bundle for DeepSeek Harness: roleplay UI, orchestration and storage.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Firefox2100",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@dsh-agentic-roleplay/state": "0.
|
|
83
|
+
"@dsh-agentic-roleplay/state": "0.13.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Call ${next} next, with card "${card}".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Stop here and report to the person, as the pause for this import says: what this stage wrote, what failed or was left out and why, and what is left (${left}). Do not run the next stage in this turn.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Stop here and report to the person, as the pause for this import says: who and what the world is made of, and what looked doubtful. Do not run a stage yet.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
This turn is the import of a character card into this new, empty world, started by the person with the /import-st command. You do it together with the person: you take a step, tell them in a few short sentences what it did and what is left, and stop where the pause below says so. Until the import is finished do not edit the world yourself (the world is written only by ${finish}), and do not ask the person anything except what the pause allows.
|
|
2
|
+
Your tools, all with card "${card}": ${status} (where the import stands: which stages are done, still to do, or stale), ${survey} (read the card, say what each piece is, list who and what the world is made of), ${surveyShow} and ${surveyEdit} (look at the survey and correct it when the person says it is wrong: the changes are kept), ${stage} (write one part of the world; the stages are ${stages}, in this order; each takes a while, and the person's note for it goes in its guidance), ${show} (what a stage staged, one document in full), ${audit} (what a stage left out), and ${finish} (writes the world and checks it as a whole). The card tools (card_overview, card_search, card_read) compare anything with the card itself.
|
|
3
|
+
The pause for this import is "${pause}": ${policy}
|
|
4
|
+
The import is at "${phase}"${done}. Start with ${status}.
|
|
5
|
+
When ${finish} reports success, review the world as a careful editor and correct what the import got wrong (see what ${finish} tells you). Then tell the person in a few short sentences what was imported (counts), what was left out and why, whether the world has a playable character (if not, say none was found and that you can add one), and anything in the notes that they should know. Then stop.
|