@dsh-agentic-roleplay/core 0.12.2 → 0.12.3
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-BZr4bgBy.js → authoring-tools-hacA5fG-.js} +1904 -1849
- package/lib/authoring.js +39 -32
- package/lib/client.js +440 -440
- package/lib/doctor.js +1 -1
- package/lib/{hooks-Dtq5KZQX.js → hooks-DlrFO4aQ.js} +199 -40
- package/lib/index.js +37 -26
- package/lib/{lorebook-author-tools-BjcEUo22.js → lorebook-author-tools-dupq-kb_.js} +4 -4
- package/lib/lorebook-authoring.js +5 -5
- package/lib/orchestration.js +4 -4
- package/lib/{pack-jail-Dt0VTsu0.js → pack-jail-Bq0fzKi4.js} +38 -11
- package/lib/{packs-DWfR2Ted.js → packs-D-7EU3yU.js} +2 -2
- package/lib/{preset-Dv5YF2qj.js → preset-RHcOG55T.js} +3 -3
- package/lib/{preset-author-tools-BUzO9mTW.js → preset-author-tools-Dwxnpv6V.js} +5 -5
- package/lib/preset-authoring.js +5 -5
- package/lib/{reflection-Dd3pEiZB.js → reflection-DibpEUQK.js} +4 -4
- package/lib/{serial-BUaJGwVy.js → serial-CDGoXYh-.js} +1197 -1216
- package/lib/{turn-guard-87NE-Cnp.js → turn-guard-DDxikrq7.js} +2 -2
- package/package.json +3 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { A as chatSessionId } from "./child-DTdY14S9.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
2
|
+
import { A as loadWorldParts, At as UPDATE_FOLDER, Bt as TRIGGERS_FILE_NAME, Ct as loadDice, D as worldFieldChanges, Dt as parseCalendarFile, Et as loadCalendar, F as editsSince, G as addressesToFetch, I as writeSnapshot, It as COMMANDS_FILE_NAME, Jt as DICE_READINGS, K as candidateUrls, Lt as commandVariable, Mt as cardPieces, O as editWorldInfo, Ot as CHARACTERS_DIR, P as recordProvenance, Q as writePortrait, Rt as loadCommands, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, Vt as loadTriggers, W as addressKey, Xt as authoredWorldOf, Y as mergeReports, Yt as DICE_RESULTS, Z as cardCharacter, Zt as authoringChatSessionId, _t as loadLocations, bt as FACTIONS_DIR, et as loadValidatedWorld, f as importPhase, gt as LOCATIONS_DIR, ht as routineProblems, jt as baseId, kt as loadCharacters, nt as knowsCharacter, o as contextOf, q as fetchPictures, qt as DICE_COMPARISONS, tt as withScratchStory, u as worldOf, vt as ITEMS_DIR, wt as parseDiceFile, xt as loadFactions, yt as loadItems, zt as parseCommandsFile } from "./authoring-tools-hacA5fG-.js";
|
|
3
|
+
import { At as writeChoices, Ct as IMPORT_FOLDER, Et as PICTURE_FILE, Gt as loadVariables, Jt as LORE_FILE_NAME, Kt as parseVariablesFile, M as WORLD_FILE_NAME, N as parseWorldFile, Qt as ITEM_FILE_NAME, St as withPlayer, Wt as VARIABLES_FILE_NAME, Xt as LOCATION_FILE_NAME, Yt as parseLoreFile, Zt as parseLocationFile, _t as loadLore, an as parseCharacterFile, en as parseItemFile, gt as LORE_DIR, in as CHARACTER_FILE_NAME, jt as InvalidEditProblems, kt as readImportFolder, l as extractStyleFrom, nn as FACTION_FILE_NAME, nt as writeWorldPrompt, qt as variableProblems, rn as parseFactionFile, vt as subfolders } from "./serial-CDGoXYh-.js";
|
|
4
4
|
import { n as encodeOutput } from "./narration--K2XVIHI.js";
|
|
5
5
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-Csp80TFX.js";
|
|
6
|
-
import { B as parsePlotsFile, F as textLanguage, K as Reader, M as LANGUAGE_NAMES, N as STORY_LANGUAGES, P as isStoryLanguage, R as PLOTS_FILE_NAME, V as plotReferenceProblems, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, q as formatIssue, st as AgentUnavailableError, z as loadPlots } from "./hooks-
|
|
6
|
+
import { B as parsePlotsFile, F as textLanguage, K as Reader, 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 formatIssue, st as AgentUnavailableError, z as loadPlots } from "./hooks-DlrFO4aQ.js";
|
|
7
7
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
8
8
|
import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-DTxakw0z.js";
|
|
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-
|
|
9
|
+
import { n as readPreset } from "./preset-RHcOG55T.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-D-7EU3yU.js";
|
|
11
11
|
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-9-5at9cZ.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";
|
|
@@ -256,11 +256,16 @@ function agentServicesOf(ctx) {
|
|
|
256
256
|
if (controller === void 0 || registry === void 0) throw new AgentUnavailableError("this DSH profile has no session services, so a roleplay chat cannot be opened");
|
|
257
257
|
const persistence = ctx.get("sessionPersistence");
|
|
258
258
|
const agents = ctx.get("agents");
|
|
259
|
+
const command = agents === void 0 ? void 0 : async (chat, line) => {
|
|
260
|
+
const live = agents.get(chat);
|
|
261
|
+
return live === void 0 ? void 0 : await runCommandLine(ctx, live, line, new AbortController().signal);
|
|
262
|
+
};
|
|
259
263
|
return {
|
|
260
264
|
controller,
|
|
261
265
|
registry,
|
|
262
266
|
...persistence === void 0 ? {} : { persistence },
|
|
263
|
-
...agents === void 0 ? {} : { unload: unloader(ctx, agents) }
|
|
267
|
+
...agents === void 0 ? {} : { unload: unloader(ctx, agents) },
|
|
268
|
+
...command === void 0 ? {} : { command }
|
|
264
269
|
};
|
|
265
270
|
};
|
|
266
271
|
}
|
|
@@ -373,9 +378,16 @@ var AgentSessions = class {
|
|
|
373
378
|
}
|
|
374
379
|
/** Says something in the chat of a session as the player would; it is queued behind what the chat is doing. The chat must exist (`ensure`). */
|
|
375
380
|
async send(sessionId, text) {
|
|
376
|
-
|
|
381
|
+
const services = this.services();
|
|
382
|
+
const chat = chatSessionId(sessionId);
|
|
383
|
+
const ran = text.startsWith("/") ? await services.command?.(chat, text) : void 0;
|
|
384
|
+
if (ran !== void 0) {
|
|
385
|
+
if (ran.kind === "error") throw new CommandRefusedError(ran.text);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
await services.controller.prompt({
|
|
377
389
|
requestId: randomUUID(),
|
|
378
|
-
sessionId:
|
|
390
|
+
sessionId: chat,
|
|
379
391
|
mode: "queue",
|
|
380
392
|
content: [{
|
|
381
393
|
type: "text",
|
|
@@ -460,11 +472,13 @@ var AuthoringSessions = class {
|
|
|
460
472
|
roleplayRoot;
|
|
461
473
|
prompts;
|
|
462
474
|
languages;
|
|
463
|
-
|
|
475
|
+
beginImport;
|
|
476
|
+
constructor(services, roleplayRoot, prompts, languages, beginImport) {
|
|
464
477
|
this.services = services;
|
|
465
478
|
this.roleplayRoot = roleplayRoot;
|
|
466
479
|
this.prompts = prompts;
|
|
467
480
|
this.languages = languages;
|
|
481
|
+
this.beginImport = beginImport;
|
|
468
482
|
}
|
|
469
483
|
async ensure(worldId, worldName, title, language) {
|
|
470
484
|
return await ensureAuthoringChat(this.services(), this.roleplayRoot(), this.prompts, this.languages, KIND, {
|
|
@@ -476,9 +490,22 @@ var AuthoringSessions = class {
|
|
|
476
490
|
renameExisting: true
|
|
477
491
|
});
|
|
478
492
|
}
|
|
493
|
+
/** Has the chat import the card waiting in its world, as the `/import-st` command does. */
|
|
494
|
+
async startImport(sessionId, request) {
|
|
495
|
+
if (this.beginImport === void 0) throw new Error("imports cannot be started here");
|
|
496
|
+
const begun = await this.beginImport(sessionId, request);
|
|
497
|
+
if (!begun.ok) throw new Error(begun.reason);
|
|
498
|
+
await this.send(sessionId, begun.message);
|
|
499
|
+
}
|
|
479
500
|
/** Sends a message into a chat as if the person had written it. */
|
|
480
501
|
async send(sessionId, text) {
|
|
481
|
-
|
|
502
|
+
const services = this.services();
|
|
503
|
+
const ran = text.startsWith("/") ? await services.command?.(sessionId, text) : void 0;
|
|
504
|
+
if (ran !== void 0) {
|
|
505
|
+
if (ran.kind === "error") throw new CommandRefusedError(ran.text);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
await services.controller.prompt({
|
|
482
509
|
requestId: randomUUID(),
|
|
483
510
|
sessionId,
|
|
484
511
|
mode: "queue",
|
|
@@ -3199,4 +3226,4 @@ function registerPackJail(ctx, deps) {
|
|
|
3199
3226
|
}
|
|
3200
3227
|
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 };
|
|
3201
3228
|
|
|
3202
|
-
//# sourceMappingURL=pack-jail-
|
|
3229
|
+
//# sourceMappingURL=pack-jail-Bq0fzKi4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as Reader } from "./hooks-
|
|
1
|
+
import { K as Reader } from "./hooks-DlrFO4aQ.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-D-7EU3yU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-hacA5fG-.js";
|
|
2
2
|
import { p as SAMPLING_RANGES } from "./child-DTdY14S9.js";
|
|
3
|
-
import {
|
|
3
|
+
import { yt as cleanText } from "./serial-CDGoXYh-.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-RHcOG55T.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-Csp80TFX.js";
|
|
2
|
-
import { $ as deleteWorldPrompt, K as presetDirectory, Q as PROSE_PROMPTS,
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import {
|
|
2
|
+
import { $ as deleteWorldPrompt, Ct as IMPORT_FOLDER, K as presetDirectory, Q as PROSE_PROMPTS, St as withPlayer, Z as updatePresetInfo, et as listWorldPrompts, l as extractStyleFrom, nt as writeWorldPrompt, q as readPreset, tt as readWorldPrompt, z as PRESET_FILE } from "./serial-CDGoXYh-.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-RHcOG55T.js";
|
|
4
|
+
import { o as contextOf } from "./authoring-tools-hacA5fG-.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-
|
|
6
|
+
import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-DlrFO4aQ.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-Dwxnpv6V.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-hacA5fG-.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-DDxikrq7.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 { K as presetDirectory } from "./serial-
|
|
4
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-Dwxnpv6V.js";
|
|
5
|
+
import "./hooks-DlrFO4aQ.js";
|
|
6
|
+
import { K as presetDirectory } from "./serial-CDGoXYh-.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
// src/preset-authoring.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
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-
|
|
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-CDGoXYh-.js";
|
|
3
3
|
import { t as promptFor } from "./access-Csp80TFX.js";
|
|
4
|
-
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts,
|
|
4
|
+
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-DlrFO4aQ.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
6
|
import { s as inheritImages } from "./library-DTxakw0z.js";
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
7
|
+
import { i as inheritPacks } from "./packs-D-7EU3yU.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";
|
|
@@ -1504,4 +1504,4 @@ function memoryReflector(deps) {
|
|
|
1504
1504
|
}
|
|
1505
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 };
|
|
1506
1506
|
|
|
1507
|
-
//# sourceMappingURL=reflection-
|
|
1507
|
+
//# sourceMappingURL=reflection-DibpEUQK.js.map
|