@dsh-agentic-roleplay/core 0.10.2 → 0.11.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-C9cmcUbD.js → authoring-tools--6V1pIIL.js} +3 -3
- package/lib/authoring.js +6 -6
- package/lib/client.js +405 -405
- package/lib/client.js.map +1 -1
- package/lib/doctor.js +1 -1
- package/lib/{hooks-BpLN_hhT.js → hooks-DORky4KT.js} +34 -53
- package/lib/index.js +9 -9
- package/lib/{lorebook-author-tools-Cg7QQemi.js → lorebook-author-tools-BrVde1N-.js} +4 -4
- package/lib/lorebook-authoring.js +4 -4
- package/lib/orchestration.js +4 -4
- package/lib/{pack-jail-D5j5mIq6.js → pack-jail-Bk82pX9t.js} +14 -7
- package/lib/{packs-Cc05FrId.js → packs-ELfh8yh1.js} +2 -2
- package/lib/{preset-Be4lz6vB.js → preset-D9Sfc8sf.js} +3 -3
- package/lib/{preset-author-tools-C3s0iSfv.js → preset-author-tools-B3pFL1-e.js} +5 -5
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-Cl9sU3Qs.js → presets-BRt4Xsy4.js} +2 -2
- package/lib/{reflection-I9z-PvFK.js → reflection-CHiHsY4Y.js} +4 -4
- package/lib/{turn-guard-B9pGCeir.js → turn-guard-B53qOWEU.js} +10 -10
- package/package.json +33 -32
package/lib/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
+
import { i as externalTools, t as externalToolLimit } from "./hooks-DORky4KT.js";
|
|
4
4
|
import { a as liveSettings } from "./narration-B0hConSw.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
|
|
@@ -3503,46 +3503,21 @@ function ownerOf(agent, turn) {
|
|
|
3503
3503
|
turn
|
|
3504
3504
|
};
|
|
3505
3505
|
}
|
|
3506
|
-
/** Where the
|
|
3507
|
-
const
|
|
3508
|
-
/**
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
withdraw();
|
|
3522
|
-
}
|
|
3523
|
-
};
|
|
3524
|
-
}
|
|
3525
|
-
/** Where the withdrawals of an agent's optional tools are kept, by tool name: on the agent, so that a reloaded plugin still finds what its earlier self registered. */
|
|
3526
|
-
const OPTIONAL_SHOWN = Symbol.for("dsh-agentic-roleplay.optional-tools");
|
|
3527
|
-
/** Puts an agent's optional tools in line with the switches: registers the ones that are on and not yet there, withdraws the ones that are off. */
|
|
3528
|
-
function optionalToolSwitch(tools) {
|
|
3529
|
-
return (agent, enabled) => {
|
|
3530
|
-
const holder = agent;
|
|
3531
|
-
const shown = holder[OPTIONAL_SHOWN] ??= /* @__PURE__ */ new Map();
|
|
3532
|
-
for (const tool of tools) {
|
|
3533
|
-
const withdraw = shown.get(tool.name);
|
|
3534
|
-
if (enabled(tool.name) && withdraw === void 0) try {
|
|
3535
|
-
shown.set(tool.name, agent.ctx.tools.register(tool));
|
|
3536
|
-
} catch (error) {
|
|
3537
|
-
if (!(error instanceof Error) || !error.message.includes("already registered")) throw error;
|
|
3538
|
-
shown.set(tool.name, () => void 0);
|
|
3539
|
-
}
|
|
3540
|
-
else if (!enabled(tool.name) && withdraw !== void 0) {
|
|
3541
|
-
shown.delete(tool.name);
|
|
3542
|
-
withdraw();
|
|
3543
|
-
}
|
|
3544
|
-
}
|
|
3545
|
-
};
|
|
3506
|
+
/** Where an agent keeps the fact that its conditional tools are registered: on the agent, so that a reloaded plugin does not register them a second time. */
|
|
3507
|
+
const CONDITIONAL_REGISTERED = Symbol.for("dsh-agentic-roleplay.conditional-tools");
|
|
3508
|
+
/**
|
|
3509
|
+
* Registers an agent's switchable tools once, before its first request. DSH asks each condition at every step and leaves a tool out of the request while
|
|
3510
|
+
* it is false, so a setting changed during a story applies at the next step without registering or withdrawing anything.
|
|
3511
|
+
*/
|
|
3512
|
+
function registerConditionalTools(agent, entries) {
|
|
3513
|
+
const holder = agent;
|
|
3514
|
+
if (holder[CONDITIONAL_REGISTERED] === true) return;
|
|
3515
|
+
for (const { tool, when } of entries) try {
|
|
3516
|
+
agent.ctx.tools.register(tool, { when });
|
|
3517
|
+
} catch (error) {
|
|
3518
|
+
if (!(error instanceof Error) || !error.message.includes("already registered")) throw error;
|
|
3519
|
+
}
|
|
3520
|
+
holder[CONDITIONAL_REGISTERED] = true;
|
|
3546
3521
|
}
|
|
3547
3522
|
/** Where an agent's withdrawal of the external tools it was not given is kept: on the agent, so that a reloaded plugin still finds what its earlier self set. */
|
|
3548
3523
|
const EXTERNAL_LIMIT = Symbol.for("dsh-agentic-roleplay.external-limit");
|
|
@@ -3574,13 +3549,22 @@ function commandBringsPeopleIn(store, command) {
|
|
|
3574
3549
|
}
|
|
3575
3550
|
function installHooks(ctx, deps) {
|
|
3576
3551
|
const { engine, boundaries, stores, timelines, previewTool } = deps;
|
|
3577
|
-
const showPreviewTool = previewToggle(previewTool);
|
|
3578
|
-
const showOptionalTools = optionalToolSwitch(deps.optionalTools ?? []);
|
|
3579
3552
|
/** The tools of the game master as the chat's settings say: its optional ones, and none of other plugins' that it was not given. */
|
|
3580
|
-
const
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3553
|
+
const applyLimit = (agent, store) => {
|
|
3554
|
+
externalToolLimit(agent, externalWithheld(agent.ctx.tools, store.settings().tools, "gameMaster"));
|
|
3555
|
+
};
|
|
3556
|
+
const conditionsOf = (chat) => {
|
|
3557
|
+
const settings = () => stores(chat)?.settings();
|
|
3558
|
+
return [{
|
|
3559
|
+
tool: previewTool,
|
|
3560
|
+
when: () => settings()?.preview.enabled === true
|
|
3561
|
+
}, ...(deps.optionalTools ?? []).map((tool) => ({
|
|
3562
|
+
tool,
|
|
3563
|
+
when: () => {
|
|
3564
|
+
const current = settings();
|
|
3565
|
+
return current !== void 0 && toolEnabled(current.tools, "gameMaster", tool.name);
|
|
3566
|
+
}
|
|
3567
|
+
}))];
|
|
3584
3568
|
};
|
|
3585
3569
|
guardRepeatedCalls(ctx, (exec) => {
|
|
3586
3570
|
const owner = exec.agent === void 0 ? void 0 : ownerOf(exec.agent, 0);
|
|
@@ -3590,8 +3574,8 @@ function installHooks(ctx, deps) {
|
|
|
3590
3574
|
const owner = ownerOf(agent, 0);
|
|
3591
3575
|
const store = owner === void 0 ? void 0 : stores(owner.chat);
|
|
3592
3576
|
if (store === void 0) return;
|
|
3593
|
-
|
|
3594
|
-
|
|
3577
|
+
registerConditionalTools(agent, conditionsOf(agent.session.id));
|
|
3578
|
+
applyLimit(agent, store);
|
|
3595
3579
|
});
|
|
3596
3580
|
ctx.on("session/event", (session, event) => {
|
|
3597
3581
|
if (event.type !== "turn/end" || session.header.origin === "subagent" || roleplaySessionOf(session.id) === void 0) return;
|
|
@@ -3641,10 +3625,7 @@ function installHooks(ctx, deps) {
|
|
|
3641
3625
|
const decision = await next();
|
|
3642
3626
|
const owner = ownerOf(payload.agent, payload.turn);
|
|
3643
3627
|
const store = owner === void 0 ? void 0 : stores(owner.chat);
|
|
3644
|
-
if (owner !== void 0 && store !== void 0)
|
|
3645
|
-
showPreviewTool(payload.agent, store.settings().preview.enabled);
|
|
3646
|
-
applyTools(payload.agent, store);
|
|
3647
|
-
}
|
|
3628
|
+
if (owner !== void 0 && store !== void 0) applyLimit(payload.agent, store);
|
|
3648
3629
|
if (decision.kind !== "enter" || payload.step !== 1) return decision;
|
|
3649
3630
|
if (owner === void 0 || store === void 0) return decision;
|
|
3650
3631
|
const text = payload.messages.filter((message) => message.source.kind === "user").flatMap((message) => message.content.flatMap((block) => block.type === "text" ? [block.text] : [])).join("\n");
|
|
@@ -3790,4 +3771,4 @@ function installHooks(ctx, deps) {
|
|
|
3790
3771
|
}
|
|
3791
3772
|
export { listFiles as $, LANGUAGE_NAMES as A, COMMANDS_KEY as B, readNotes as C, PLOTS_METADATA_KEY as D, answerLimits as E, readUsage as F, formatIssue as G, commandsOf as H, PLOTS_FILE_NAME as I, PROMPTS_FOLDER as J, errorMessage as K, loadPlots as L, isStoryLanguage as M, textLanguage as N, plotProgressOf as O, wrongLanguage as P, languageOf as Q, parsePlotsFile as R, notesOfSession as S, RESULTS as T, readDocument as U, commandFlagKey as V, Reader as W, copyWorldPrompts as X, PromptLibrary as Y, inheritPrompts as Z, readTraces as _, externalWithheld as a, InvalidStartError as at, readWithdrawn as b, record as c, SessionArchivedError as ct, guardRepeatedCalls as d, ClockError as dt, promptProblem as et, MAX_OOC_ANSWER as f, describeTime as ft, readRunDetail as g, COMPARISONS as gt, readActivity as h, AUTHORING_NEEDS as ht, externalTools as i, AgentUnavailableError as it, STORY_LANGUAGES as j, populatePlots as k, characterRunner as l, SessionNotFoundError as lt, readDecisionStats as m, zoneOf as mt, installHooks as n, shippedPromptsDirectory as nt, PREVIEW_TOOL as o, InvalidWorldError as ot, storesOf as p, describeWhen as pt, LANGUAGE_FOLDER as q, externalGiven as r, shippedText as rt, createTools$1 as s, ReflectionRefusedError as st, externalToolLimit as t, shippedLanguages as tt, toolEnabled as u, WorldNotFoundError as ut, readVerdicts as v, observeAsPlayer as w, addToNote as x, writeVerdicts as y, plotReferenceProblems as z };
|
|
3792
3773
|
|
|
3793
|
-
//# sourceMappingURL=hooks-
|
|
3774
|
+
//# sourceMappingURL=hooks-DORky4KT.js.map
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { a as VARIABLE_KINDS, c as chatSessionId, i as atomicWriteSync, l as roleplaySessionOf, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { $t as subfolders, At as populateLore, Bt as loadLocations, Ct as populateCharacters, Dt as populateItems, E as loadWorldParts, Et as populateFactions, F as localChanges, Ft as TRIGGERS_FILE_NAME, G as vetUrl, Gt as DICE_FILE_NAME, Ht as loadItems, I as readOrigin, Jt as CALENDAR_FILE_NAME, Kt as loadDice, L as writeOrigin, M as describeChanges, Mt as populateTriggers, N as hashWorld, Nt as populateVariables, Ot as populateKnowledge, P as isUnchanged, Pt as routineProblems, Qt as loadCharacters, R as CatalogueError, St as populateCalendar, T as readWorldInfo, Tt as populateDice, U as guardedLookup, Xt as parseCalendarFile, Yt as loadCalendar, Zt as CHARACTERS_DIR, _ as runChecks, _t as writeLorebookEntry, an as readCard, at as addLorebookEntries, c as importPhase, cn as DICE_RESULTS, ct as deleteLorebookEntry, d as markReady, dt as listLorebooks, en as knownOutputCeiling, et as WORLD_FILE_NAME, f as settleDraft, ft as loadLorebook, gt as updateLorebookInfo, ht as reserveLorebook, in as pictureOf, it as questionView, jt as populateRoutines, kt as populateLocations, ln as authoredWorldOf, lt as entriesOf, nn as cardFormat, nt as parseWorldInfoEdit, on as DICE_COMPARISONS, ot as createLorebook, p as structureImport, pt as lorebookDirectory, qt as parseDiceFile, rn as isPng, rt as combineAnswers, sn as DICE_READINGS, st as deleteLorebook, t as AuthoringTools, tn as ImportCardError, tt as parseWorldFile, u as keepDraft, ut as isLorebookName, vt as checkWorld, w as editWorldInfo, wt as populateClock, xt as knowsCharacter, yt as loadValidatedWorld } from "./authoring-tools
|
|
3
|
-
import { a as lorebookImportMessage, c as readLorebook, d as lorebookOfChat, l as selectEntries, s as previewLorebook, t as LOREBOOK_UPLOAD, u as lorebookChatSessionId } from "./lorebook-author-tools-
|
|
4
|
-
import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-
|
|
5
|
-
import { $ as listFiles, B as COMMANDS_KEY, C as readNotes, D as PLOTS_METADATA_KEY, F as readUsage, G as formatIssue, J as PROMPTS_FOLDER, K as errorMessage, O as plotProgressOf, Q as languageOf, R as parsePlotsFile, S as notesOfSession, U as readDocument, X as copyWorldPrompts, Y as PromptLibrary, _ as readTraces, at as InvalidStartError, b as readWithdrawn, ct as SessionArchivedError, et as promptProblem, g as readRunDetail, h as readActivity, i as externalTools, it as AgentUnavailableError, k as populatePlots, lt as SessionNotFoundError, m as readDecisionStats, mt as zoneOf, ot as InvalidWorldError, q as LANGUAGE_FOLDER, st as ReflectionRefusedError, tt as shippedLanguages, ut as WorldNotFoundError, w as observeAsPlayer, x as addToNote, z as plotReferenceProblems } from "./hooks-
|
|
2
|
+
import { $t as subfolders, At as populateLore, Bt as loadLocations, Ct as populateCharacters, Dt as populateItems, E as loadWorldParts, Et as populateFactions, F as localChanges, Ft as TRIGGERS_FILE_NAME, G as vetUrl, Gt as DICE_FILE_NAME, Ht as loadItems, I as readOrigin, Jt as CALENDAR_FILE_NAME, Kt as loadDice, L as writeOrigin, M as describeChanges, Mt as populateTriggers, N as hashWorld, Nt as populateVariables, Ot as populateKnowledge, P as isUnchanged, Pt as routineProblems, Qt as loadCharacters, R as CatalogueError, St as populateCalendar, T as readWorldInfo, Tt as populateDice, U as guardedLookup, Xt as parseCalendarFile, Yt as loadCalendar, Zt as CHARACTERS_DIR, _ as runChecks, _t as writeLorebookEntry, an as readCard, at as addLorebookEntries, c as importPhase, cn as DICE_RESULTS, ct as deleteLorebookEntry, d as markReady, dt as listLorebooks, en as knownOutputCeiling, et as WORLD_FILE_NAME, f as settleDraft, ft as loadLorebook, gt as updateLorebookInfo, ht as reserveLorebook, in as pictureOf, it as questionView, jt as populateRoutines, kt as populateLocations, ln as authoredWorldOf, lt as entriesOf, nn as cardFormat, nt as parseWorldInfoEdit, on as DICE_COMPARISONS, ot as createLorebook, p as structureImport, pt as lorebookDirectory, qt as parseDiceFile, rn as isPng, rt as combineAnswers, sn as DICE_READINGS, st as deleteLorebook, t as AuthoringTools, tn as ImportCardError, tt as parseWorldFile, u as keepDraft, ut as isLorebookName, vt as checkWorld, w as editWorldInfo, wt as populateClock, xt as knowsCharacter, yt as loadValidatedWorld } from "./authoring-tools--6V1pIIL.js";
|
|
3
|
+
import { a as lorebookImportMessage, c as readLorebook, d as lorebookOfChat, l as selectEntries, s as previewLorebook, t as LOREBOOK_UPLOAD, u as lorebookChatSessionId } from "./lorebook-author-tools-BrVde1N-.js";
|
|
4
|
+
import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-B3pFL1-e.js";
|
|
5
|
+
import { $ as listFiles, B as COMMANDS_KEY, C as readNotes, D as PLOTS_METADATA_KEY, F as readUsage, G as formatIssue, J as PROMPTS_FOLDER, K as errorMessage, O as plotProgressOf, Q as languageOf, R as parsePlotsFile, S as notesOfSession, U as readDocument, X as copyWorldPrompts, Y as PromptLibrary, _ as readTraces, at as InvalidStartError, b as readWithdrawn, ct as SessionArchivedError, et as promptProblem, g as readRunDetail, h as readActivity, i as externalTools, it as AgentUnavailableError, k as populatePlots, lt as SessionNotFoundError, m as readDecisionStats, mt as zoneOf, ot as InvalidWorldError, q as LANGUAGE_FOLDER, st as ReflectionRefusedError, tt as shippedLanguages, ut as WorldNotFoundError, w as observeAsPlayer, x as addToNote, z as plotReferenceProblems } from "./hooks-DORky4KT.js";
|
|
6
6
|
import { a as liveSettings, c as writeSettings, d as parseSettings, i as InvalidSettingsError, l as DEFAULT_SETTINGS, o as readSettings, p as WORLD_RULES_KEY, s as useChildReasoning, u as SETTINGS_SPEC } from "./narration-B0hConSw.js";
|
|
7
|
-
import { $ as DOCTOR_OPENING_SOURCE, A as worldEntityImageFile, B as languageOfDocuments, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as PRESET_FILE, G as revertUpdate, H as findTargets, I as presetMessage, J as AuthoringSessions, K as startUpdate, O as uploadWorldEntityImage, Q as agentServicesOf, R as translateMessage, S as generateWorldEntityImage, T as removeWorldTrigger, V as readWorldDocuments, X as ensureAuthoringChat, Y as authoringTitle, Z as AgentSessions, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, et as appendEmptyTurn, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, q as updateStatus, t as MAX_PACK_TEXT, tt as appendNarratedTurn, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1 } from "./pack-jail-
|
|
7
|
+
import { $ as DOCTOR_OPENING_SOURCE, A as worldEntityImageFile, B as languageOfDocuments, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as PRESET_FILE, G as revertUpdate, H as findTargets, I as presetMessage, J as AuthoringSessions, K as startUpdate, O as uploadWorldEntityImage, Q as agentServicesOf, R as translateMessage, S as generateWorldEntityImage, T as removeWorldTrigger, V as readWorldDocuments, X as ensureAuthoringChat, Y as authoringTitle, Z as AgentSessions, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, et as appendEmptyTurn, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, q as updateStatus, t as MAX_PACK_TEXT, tt as appendNarratedTurn, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1 } from "./pack-jail-Bk82pX9t.js";
|
|
8
8
|
import { d as parseSampling, f as sharedSamplingOf, i as childSamplingOf, m as RECOVERY_SHRINK, p as RECOVERY_FLOOR, s as isUnfinishedCall, x as totalTokens } from "./child-C9nPIy9j.js";
|
|
9
|
-
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, Ft as parseRelationEdit, G as deleteWorldPrompt, It as parseThingEdit, J as writeWorldPrompt, K as listWorldPrompts, Lt as LORE_KINDS, Mt as parseFactionEdit, Nt as parseLoreEdit, Pt as parsePlaceEdit, Q as withPlayer, Rt as LORE_SCOPES, Z as partsOf, a as isPresetName, at as readImportFolder, c as presetDirectory, ct as sourceSummary, d as savePresetFromWorld, et as ImportNotFoundError, ft as VARIABLES_FILE_NAME, ht as variableProblems, i as deletePreset, it as parseChoices, jt as parseCharacterEdit, lt as IMPORT_COMMAND, mt as parseVariablesFile, o as listPresets, p as updatePresetInfo, pt as loadVariables, q as readWorldPrompt, r as createPresetFromShipped, s as loadPreset, t as PRESET_FILE$1, tt as ImportStore, u as reservePreset } from "./presets-
|
|
9
|
+
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, Ft as parseRelationEdit, G as deleteWorldPrompt, It as parseThingEdit, J as writeWorldPrompt, K as listWorldPrompts, Lt as LORE_KINDS, Mt as parseFactionEdit, Nt as parseLoreEdit, Pt as parsePlaceEdit, Q as withPlayer, Rt as LORE_SCOPES, Z as partsOf, a as isPresetName, at as readImportFolder, c as presetDirectory, ct as sourceSummary, d as savePresetFromWorld, et as ImportNotFoundError, ft as VARIABLES_FILE_NAME, ht as variableProblems, i as deletePreset, it as parseChoices, jt as parseCharacterEdit, lt as IMPORT_COMMAND, mt as parseVariablesFile, o as listPresets, p as updatePresetInfo, pt as loadVariables, q as readWorldPrompt, r as createPresetFromShipped, s as loadPreset, t as PRESET_FILE$1, tt as ImportStore, u as reservePreset } from "./presets-BRt4Xsy4.js";
|
|
10
10
|
import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-CzqhC8sT.js";
|
|
11
|
-
import { _ as START_SNAPSHOT, b as snapshotOf, c as copyPreset, d as switchPreset, f as defaultBoundaries, g as writeTimeline, h as readTimeline, i as reflectionStatus, l as presetStatus, o as TimelineError, u as recordPreset, v as childrenOf, y as pathTo } from "./reflection-
|
|
12
|
-
import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-
|
|
11
|
+
import { _ as START_SNAPSHOT, b as snapshotOf, c as copyPreset, d as switchPreset, f as defaultBoundaries, g as writeTimeline, h as readTimeline, i as reflectionStatus, l as presetStatus, o as TimelineError, u as recordPreset, v as childrenOf, y as pathTo } from "./reflection-CHiHsY4Y.js";
|
|
12
|
+
import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-D9Sfc8sf.js";
|
|
13
13
|
import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-CH-ahlm0.js";
|
|
14
14
|
import { t as doctorChatSessionId } from "./doctor-chat-hL1a61hp.js";
|
|
15
|
-
import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-
|
|
15
|
+
import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-ELfh8yh1.js";
|
|
16
16
|
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
|
|
17
17
|
import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-CtG-bDzz.js";
|
|
18
18
|
import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-CXtaZNbx.js";
|
|
2
|
-
import { _t as writeLorebookEntry, ct as deleteLorebookEntry, ft as loadLorebook, gt as updateLorebookInfo, i as contextOf, lt as entriesOf, mt as readLorebook$1, pt as lorebookDirectory, r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools
|
|
3
|
-
import { $ as IMPORT_FOLDER, Lt as LORE_KINDS, Q as withPlayer, Rt as LORE_SCOPES, Y as cleanText, Z as partsOf, n as createPresetFromGuidance } from "./presets-
|
|
2
|
+
import { _t as writeLorebookEntry, ct as deleteLorebookEntry, ft as loadLorebook, gt as updateLorebookInfo, i as contextOf, lt as entriesOf, mt as readLorebook$1, pt as lorebookDirectory, r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools--6V1pIIL.js";
|
|
3
|
+
import { $ as IMPORT_FOLDER, Lt as LORE_KINDS, Q as withPlayer, Rt as LORE_SCOPES, Y as cleanText, Z as partsOf, n as createPresetFromGuidance } from "./presets-BRt4Xsy4.js";
|
|
4
4
|
import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
6
|
-
import { nt as shippedPromptsDirectory } from "./hooks-
|
|
6
|
+
import { nt as shippedPromptsDirectory } from "./hooks-DORky4KT.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
@@ -696,4 +696,4 @@ async function lorebookApproval(exec, next, state) {
|
|
|
696
696
|
}
|
|
697
697
|
export { lorebookImportMessage as a, readLorebook as c, lorebookOfChat as d, lorebookAuthorTools as i, selectEntries as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, previewLorebook as s, LOREBOOK_UPLOAD as t, lorebookChatSessionId as u };
|
|
698
698
|
|
|
699
|
-
//# sourceMappingURL=lorebook-author-tools-
|
|
699
|
+
//# sourceMappingURL=lorebook-author-tools-BrVde1N-.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents, pt as lorebookDirectory } from "./authoring-tools
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-
|
|
4
|
-
import "./hooks-
|
|
1
|
+
import { n as limitAuthoringAgents, pt as lorebookDirectory } from "./authoring-tools--6V1pIIL.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-B53qOWEU.js";
|
|
3
|
+
import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-BrVde1N-.js";
|
|
4
|
+
import "./hooks-DORky4KT.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { existsSync, readdirSync } from "node:fs";
|
|
7
7
|
// src/lorebook-authoring.ts
|
package/lib/orchestration.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as chatSessionId, l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { B as COMMANDS_KEY, H as commandsOf, P as wrongLanguage, T as RESULTS, V as commandFlagKey, c as record, dt as ClockError, f as MAX_OOC_ANSWER, ht as AUTHORING_NEEDS, l as characterRunner, mt as zoneOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, pt as describeWhen, r as externalGiven, rt as shippedText, s as createTools$1, st as ReflectionRefusedError, u as toolEnabled, v as readVerdicts, y as writeVerdicts } from "./hooks-
|
|
2
|
+
import { B as COMMANDS_KEY, H as commandsOf, P as wrongLanguage, T as RESULTS, V as commandFlagKey, c as record, dt as ClockError, f as MAX_OOC_ANSWER, ht as AUTHORING_NEEDS, l as characterRunner, mt as zoneOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, pt as describeWhen, r as externalGiven, rt as shippedText, s as createTools$1, st as ReflectionRefusedError, u as toolEnabled, v as readVerdicts, y as writeVerdicts } from "./hooks-DORky4KT.js";
|
|
3
3
|
import { E as tokensOf, S as currentTurn, T as estimateAnswer, a as childTrace, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
|
|
4
|
-
import { a as whereabouts, m as referent, n as memoryReflector, p as sameWords, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-
|
|
5
|
-
import { B as modeFor, H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, Vt as INTENT_STATUSES, m as STANDING_PROMPT } from "./presets-
|
|
4
|
+
import { a as whereabouts, m as referent, n as memoryReflector, p as sameWords, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-CHiHsY4Y.js";
|
|
5
|
+
import { B as modeFor, H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, Vt as INTENT_STATUSES, m as STANDING_PROMPT } from "./presets-BRt4Xsy4.js";
|
|
6
6
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
7
7
|
import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-B0hConSw.js";
|
|
8
8
|
import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CH-ahlm0.js";
|
|
9
|
-
import { _ as API_PREFIX } from "./packs-
|
|
9
|
+
import { _ as API_PREFIX } from "./packs-ELfh8yh1.js";
|
|
10
10
|
import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CtG-bDzz.js";
|
|
11
11
|
import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-UKbKYXMO.js";
|
|
12
12
|
import { join } from "node:path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as chatSessionId, n as atomicWrite, r as atomicWriteJson } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { $t as subfolders, A as editsSince, B as addressesToFetch, Bt as loadLocations, C as worldFieldChanges, E as loadWorldParts, Ft as TRIGGERS_FILE_NAME, H as fetchPictures, Ht as loadItems, It as loadTriggers, J as UPDATE_FOLDER, K as cardCharacter, Lt as LORE_DIR, Qt as loadCharacters, Rt as loadLore, Ut as FACTIONS_DIR, V as candidateUrls, Vt as ITEMS_DIR, W as mergeReports, Wt as loadFactions, X as cardPieces, Y as baseId, Yt as loadCalendar, Zt as CHARACTERS_DIR, bt as withScratchStory, c as importPhase, i as contextOf, j as writeSnapshot, k as recordProvenance, ln as authoredWorldOf, q as writePortrait, s as worldOf, un as authoringChatSessionId, w as editWorldInfo, x as matchPieces, xt as knowsCharacter, yt as loadValidatedWorld, z as addressKey, zt as LOCATIONS_DIR } from "./authoring-tools
|
|
3
|
-
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-
|
|
2
|
+
import { $t as subfolders, A as editsSince, B as addressesToFetch, Bt as loadLocations, C as worldFieldChanges, E as loadWorldParts, Ft as TRIGGERS_FILE_NAME, H as fetchPictures, Ht as loadItems, It as loadTriggers, J as UPDATE_FOLDER, K as cardCharacter, Lt as LORE_DIR, Qt as loadCharacters, Rt as loadLore, Ut as FACTIONS_DIR, V as candidateUrls, Vt as ITEMS_DIR, W as mergeReports, Wt as loadFactions, X as cardPieces, Y as baseId, Yt as loadCalendar, Zt as CHARACTERS_DIR, bt as withScratchStory, c as importPhase, i as contextOf, j as writeSnapshot, k as recordProvenance, ln as authoredWorldOf, q as writePortrait, s as worldOf, un as authoringChatSessionId, w as editWorldInfo, x as matchPieces, xt as knowsCharacter, yt as loadValidatedWorld, z as addressKey, zt as LOCATIONS_DIR } from "./authoring-tools--6V1pIIL.js";
|
|
3
|
+
import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-BRt4Xsy4.js";
|
|
4
4
|
import { n as encodeOutput } from "./narration-B0hConSw.js";
|
|
5
|
-
import { A as LANGUAGE_NAMES, G as formatIssue, I as PLOTS_FILE_NAME, J as PROMPTS_FOLDER, L as loadPlots, M as isStoryLanguage, N as textLanguage, R as parsePlotsFile, W as Reader, it as AgentUnavailableError, j as STORY_LANGUAGES, ot as InvalidWorldError, tt as shippedLanguages, ut as WorldNotFoundError, z as plotReferenceProblems } from "./hooks-
|
|
5
|
+
import { A as LANGUAGE_NAMES, G as formatIssue, I as PLOTS_FILE_NAME, J as PROMPTS_FOLDER, L as loadPlots, M as isStoryLanguage, N as textLanguage, R as parsePlotsFile, W as Reader, it as AgentUnavailableError, j as STORY_LANGUAGES, ot as InvalidWorldError, tt as shippedLanguages, ut as WorldNotFoundError, z as plotReferenceProblems } from "./hooks-DORky4KT.js";
|
|
6
6
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
7
7
|
import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
8
|
-
import { n as readPreset } from "./preset-
|
|
9
|
-
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-
|
|
8
|
+
import { n as readPreset } from "./preset-D9Sfc8sf.js";
|
|
9
|
+
import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-ELfh8yh1.js";
|
|
10
10
|
import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
|
|
11
11
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
12
12
|
import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
|
|
@@ -2569,6 +2569,8 @@ const PACK_FILE_TOOLS = [
|
|
|
2569
2569
|
"edit"
|
|
2570
2570
|
];
|
|
2571
2571
|
const WRITING = ["write", "edit"];
|
|
2572
|
+
/** A patch names its files inside its own text, so it cannot be held to the packs: it is refused, and `write` and `edit` do the same work. */
|
|
2573
|
+
const PATCHING = "apply_patch";
|
|
2572
2574
|
/** The most text a call may carry. */
|
|
2573
2575
|
const MAX_PACK_TEXT = 204800;
|
|
2574
2576
|
function unsafePath(ui, path) {
|
|
@@ -2612,7 +2614,12 @@ const textOf = (value) => typeof value === "string" ? [value] : [];
|
|
|
2612
2614
|
*/
|
|
2613
2615
|
async function packJail(exec, next, deps) {
|
|
2614
2616
|
const chat = exec.agent?.session.id;
|
|
2615
|
-
if (
|
|
2617
|
+
if (chat === void 0 || authoredWorldOf(chat) === void 0) return await next();
|
|
2618
|
+
if (exec.name === PATCHING) return {
|
|
2619
|
+
kind: "deny",
|
|
2620
|
+
reason: "apply_patch is not available in this chat: change an interface pack file with write or edit"
|
|
2621
|
+
};
|
|
2622
|
+
if (!PACK_FILE_TOOLS.includes(exec.name)) return await next();
|
|
2616
2623
|
const world = await deps.worldDirectory(chat);
|
|
2617
2624
|
if (world === void 0) return {
|
|
2618
2625
|
kind: "deny",
|
|
@@ -2653,4 +2660,4 @@ function registerPackJail(ctx, deps) {
|
|
|
2653
2660
|
}
|
|
2654
2661
|
export { DOCTOR_OPENING_SOURCE as $, worldEntityImageFile as A, languageOfDocuments as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, PRESET_FILE as F, revertUpdate as G, findTargets as H, presetMessage as I, AuthoringSessions as J, startUpdate as K, presetTools as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, agentServicesOf as Q, translateMessage as R, generateWorldEntityImage as S, removeWorldTrigger as T, finishUpdate as U, readWorldDocuments as V, pendingUpdate as W, ensureAuthoringChat as X, authoringTitle as Y, AgentSessions as Z, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, appendEmptyTurn as et, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, editWorldLore as m, packFileProblem as n, listWorldPacks as o, editWorldFaction as p, updateStatus as q, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, appendNarratedTurn as tt, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, translateTools as z };
|
|
2655
2662
|
|
|
2656
|
-
//# sourceMappingURL=pack-jail-
|
|
2663
|
+
//# sourceMappingURL=pack-jail-Bk82pX9t.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as Reader } from "./hooks-
|
|
1
|
+
import { W as Reader } from "./hooks-DORky4KT.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-ELfh8yh1.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools
|
|
1
|
+
import { r as MAX_PREVIEW_TEXT, tn as ImportCardError } from "./authoring-tools--6V1pIIL.js";
|
|
2
2
|
import { u as SAMPLING_RANGES } from "./child-C9nPIy9j.js";
|
|
3
|
-
import { Y as cleanText } from "./presets-
|
|
3
|
+
import { Y as cleanText } from "./presets-BRt4Xsy4.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-D9Sfc8sf.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./access-CXtaZNbx.js";
|
|
2
|
-
import { $ as IMPORT_FOLDER, G as deleteWorldPrompt, J as writeWorldPrompt, K as listWorldPrompts, Q as withPlayer, W as PROSE_PROMPTS, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as readWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-
|
|
3
|
-
import { n as readPreset$1 } from "./preset-
|
|
4
|
-
import { i as contextOf } from "./authoring-tools
|
|
2
|
+
import { $ as IMPORT_FOLDER, G as deleteWorldPrompt, J as writeWorldPrompt, K as listWorldPrompts, Q as withPlayer, W as PROSE_PROMPTS, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as readWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-BRt4Xsy4.js";
|
|
3
|
+
import { n as readPreset$1 } from "./preset-D9Sfc8sf.js";
|
|
4
|
+
import { i as contextOf } from "./authoring-tools--6V1pIIL.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
|
|
6
|
-
import { Q as languageOf$1, nt as shippedPromptsDirectory, tt as shippedLanguages } from "./hooks-
|
|
6
|
+
import { Q as languageOf$1, nt as shippedPromptsDirectory, tt as shippedLanguages } from "./hooks-DORky4KT.js";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -278,4 +278,4 @@ async function presetApproval(exec, next, carries) {
|
|
|
278
278
|
}
|
|
279
279
|
export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
|
|
280
280
|
|
|
281
|
-
//# sourceMappingURL=preset-author-tools-
|
|
281
|
+
//# sourceMappingURL=preset-author-tools-B3pFL1-e.js.map
|
package/lib/preset-authoring.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as limitAuthoringAgents } from "./authoring-tools
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-
|
|
4
|
-
import "./hooks-
|
|
5
|
-
import { c as presetDirectory } from "./presets-
|
|
1
|
+
import { n as limitAuthoringAgents } from "./authoring-tools--6V1pIIL.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-B53qOWEU.js";
|
|
3
|
+
import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-B3pFL1-e.js";
|
|
4
|
+
import "./hooks-DORky4KT.js";
|
|
5
|
+
import { c as presetDirectory } from "./presets-BRt4Xsy4.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
// src/preset-authoring.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-CXtaZNbx.js";
|
|
2
2
|
import "./narration-B0hConSw.js";
|
|
3
|
-
import { $ as listFiles, G as formatIssue, J as PROMPTS_FOLDER, K as errorMessage, Q as languageOf, U as readDocument, W as Reader, et as promptProblem, nt as shippedPromptsDirectory, q as LANGUAGE_FOLDER, tt as shippedLanguages } from "./hooks-
|
|
3
|
+
import { $ as listFiles, G as formatIssue, J as PROMPTS_FOLDER, K as errorMessage, Q as languageOf, U as readDocument, W as Reader, et as promptProblem, nt as shippedPromptsDirectory, q as LANGUAGE_FOLDER, tt as shippedLanguages } from "./hooks-DORky4KT.js";
|
|
4
4
|
import { i as translator, r as languageOf$1 } from "./text-CzqhC8sT.js";
|
|
5
5
|
import { d as parseSampling } from "./child-C9nPIy9j.js";
|
|
6
6
|
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CH-ahlm0.js";
|
|
@@ -4147,4 +4147,4 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
|
|
|
4147
4147
|
}
|
|
4148
4148
|
export { IMPORT_FOLDER as $, sourcesFor as A, InvalidEditProblems as At, modeFor as B, DEFAULT_SLOTS as Bt, inert as C, parseSlotsFile as Ct, pruneLoreSubjects as D, parseCharacterFile as Dt, pruneLinks as E, CHARACTER_FILE_NAME as Et, ROLE_TABLE as F, parseRelationEdit as Ft, deleteWorldPrompt as G, routeVerdicts as H, isLeftOut as I, parseThingEdit as It, writeWorldPrompt as J, listWorldPrompts as K, announceProblem as L, LORE_KINDS as Lt, classifyItems as M, parseFactionEdit as Mt, findEntity as N, parseLoreEdit as Nt, pruneMembers as O, readVariableValues as Ot, ROLES as P, parsePlaceEdit as Pt, withPlayer as Q, askYesNo as R, LORE_SCOPES as Rt, extractVariables as S, parseItemFile as St, pruneKnowledge as T, parseFactionFile as Tt, yesAt as U, noAt as V, INTENT_STATUSES as Vt, PROSE_PROMPTS as W, itemise as X, cleanText as Y, partsOf as Z, characterDocument as _, parseLoreFile as _t, isPresetName as a, readImportFolder as at, extractStyle as b, ITEM_FILE_NAME as bt, presetDirectory as c, sourceSummary as ct, savePresetFromWorld as d, parseAuthoringCommand as dt, ImportNotFoundError as et, sha as f, VARIABLES_FILE_NAME as ft, asWritten as g, LORE_FILE_NAME as gt, addLore as h, variableProblems as ht, deletePreset as i, parseChoices as it, buildRoster as j, parseCharacterEdit as jt, pruneRelationships as k, readIdentifier as kt, readPreset as l, IMPORT_COMMAND as lt, STANDING_PROMPT as m, parseVariablesFile as mt, createPresetFromGuidance as n, PICTURE_FILE as nt, listPresets as o, writeChoices as ot, updatePresetInfo as p, loadVariables as pt, readWorldPrompt as q, createPresetFromShipped as r, openingText as rt, loadPreset as s, dialectOf as st, PRESET_FILE as t, ImportStore as tt, reservePreset as u, parseImportCommand as ut, emptyExtracted as v, LOCATION_FILE_NAME as vt, loreDocuments as w, FACTION_FILE_NAME as wt, extractStyleFrom as x, SLOTS_FILE_NAME as xt, extractEntities as y, parseLocationFile as yt, mergeReports as z, WEEKDAY_NAMES as zt };
|
|
4149
4149
|
|
|
4150
|
-
//# sourceMappingURL=presets-
|
|
4150
|
+
//# sourceMappingURL=presets-BRt4Xsy4.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
|
|
2
|
-
import { H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, f as sha, o as listPresets, s as loadPreset, z as mergeReports } from "./presets-
|
|
3
|
-
import { E as answerLimits, J as PROMPTS_FOLDER, P as wrongLanguage, Z as inheritPrompts, ft as describeTime, pt as describeWhen } from "./hooks-
|
|
2
|
+
import { H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, f as sha, o as listPresets, s as loadPreset, z as mergeReports } from "./presets-BRt4Xsy4.js";
|
|
3
|
+
import { E as answerLimits, J as PROMPTS_FOLDER, P as wrongLanguage, Z as inheritPrompts, ft as describeTime, pt as describeWhen } from "./hooks-DORky4KT.js";
|
|
4
4
|
import { i as translator, r as languageOf, t as trimCharacters } from "./text-CzqhC8sT.js";
|
|
5
5
|
import { T as estimateAnswer, a as childTrace, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
|
|
6
6
|
import { s as inheritImages } from "./library-CH-ahlm0.js";
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
7
|
+
import { i as inheritPacks } from "./packs-ELfh8yh1.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { MINUTE, characterKey, describeDuration, locationKey, mentioned, overlap, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
10
10
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -2097,4 +2097,4 @@ function memoryReflector(deps) {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
export { START_SNAPSHOT as _, whereabouts as a, snapshotOf as b, copyPreset as c, switchPreset as d, defaultBoundaries as f, writeTimeline as g, readTimeline as h, reflectionStatus as i, presetStatus as l, referent as m, memoryReflector as n, TimelineError as o, sameWords as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u, childrenOf as v, pathTo as y };
|
|
2099
2099
|
|
|
2100
|
-
//# sourceMappingURL=reflection-
|
|
2100
|
+
//# sourceMappingURL=reflection-CHiHsY4Y.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as cutOff, w as finishOf } from "./child-C9nPIy9j.js";
|
|
2
|
-
import { d as guardRepeatedCalls } from "./hooks-
|
|
2
|
+
import { d as guardRepeatedCalls } from "./hooks-DORky4KT.js";
|
|
3
3
|
import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
// src/host/authoring/turn-guard.ts
|
|
5
5
|
/**
|
|
@@ -12,19 +12,19 @@ import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
|
12
12
|
function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
|
|
13
13
|
const nudged = /* @__PURE__ */ new Map();
|
|
14
14
|
guardRepeatedCalls(ctx, (exec) => exec.agent === void 0 ? void 0 : languageOf(exec.agent.session.id), 3);
|
|
15
|
-
ctx.on("agent/
|
|
16
|
-
const config = await next();
|
|
15
|
+
ctx.on("agent/created", async ({ agent, signal }) => {
|
|
17
16
|
const level = reasoning();
|
|
18
|
-
|
|
17
|
+
const current = agent.model.current();
|
|
18
|
+
if (level === "" || current === void 0 || agent.session.header.origin === "subagent" || languageOf(agent.session.id) === void 0 || current.reasoningEffort === level) return;
|
|
19
19
|
try {
|
|
20
|
-
if ((await
|
|
20
|
+
if ((await agent.ctx.llm.resolveModelInfo(current.provider, current.model, signal ?? new AbortController().signal)).reasoning?.efforts.some((effort) => effort.id === level) !== true) return;
|
|
21
21
|
} catch {
|
|
22
|
-
return
|
|
22
|
+
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
...
|
|
24
|
+
agent.model.select({
|
|
25
|
+
...current,
|
|
26
26
|
reasoningEffort: ReasoningEffortId(level)
|
|
27
|
-
};
|
|
27
|
+
});
|
|
28
28
|
});
|
|
29
29
|
ctx.on("agent/turn-stopping", ({ agent, turn }) => {
|
|
30
30
|
if (agent.session.header.origin === "subagent") return;
|
|
@@ -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-B53qOWEU.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.11.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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=22",
|
|
41
|
-
"dsh": ">=0.2.
|
|
41
|
+
"dsh": ">=0.2.2-rc.1 <0.2.3"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
@@ -74,43 +74,44 @@
|
|
|
74
74
|
],
|
|
75
75
|
"license": "GPL-3.0-only",
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
77
|
+
"@deepseek-ai/dsh": ">=0.2.2-rc.1 <0.2.3",
|
|
78
78
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@dsh-agentic-roleplay/state": "0.
|
|
82
|
-
"@dsh-ai-providers/core": "^0.
|
|
81
|
+
"@dsh-agentic-roleplay/state": "0.11.0",
|
|
82
|
+
"@dsh-ai-providers/core": "^0.6.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
86
86
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.6",
|
|
87
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
88
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
89
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.
|
|
90
|
-
"@deepseek-ai/dsh-client-locale": "0.2.
|
|
91
|
-
"@deepseek-ai/dsh-client-store": "0.2.
|
|
92
|
-
"@deepseek-ai/dsh-client-ui-chat": "0.2.
|
|
93
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.2.
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.2.
|
|
95
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.
|
|
97
|
-
"@deepseek-ai/dsh-client-ui-session": "0.2.
|
|
98
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.
|
|
99
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.
|
|
100
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.
|
|
101
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.
|
|
102
|
-
"@deepseek-ai/dsh-compaction": "0.2.
|
|
103
|
-
"@deepseek-ai/dsh-compaction-basic": "0.2.
|
|
104
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.
|
|
105
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
106
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
107
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
108
|
-
"@deepseek-ai/dsh-subagent": "0.2.
|
|
109
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.
|
|
110
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
111
|
-
"@deepseek-ai/dsh-token-meter": "0.2.
|
|
112
|
-
"@deepseek-ai/dsh-
|
|
113
|
-
"@deepseek-ai/dsh-
|
|
87
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.1",
|
|
88
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-rc.1",
|
|
89
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
|
|
90
|
+
"@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
|
|
91
|
+
"@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
|
|
92
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.2.2-rc.1",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.1",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.1",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.1",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.1",
|
|
98
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
|
|
99
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.2-rc.1",
|
|
100
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.2-rc.1",
|
|
101
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
|
|
102
|
+
"@deepseek-ai/dsh-compaction": "0.2.2-rc.1",
|
|
103
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.2-rc.1",
|
|
104
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.2-rc.1",
|
|
105
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.1",
|
|
106
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.1",
|
|
107
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
|
|
108
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-rc.1",
|
|
109
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-rc.1",
|
|
110
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
|
|
111
|
+
"@deepseek-ai/dsh-token-meter": "0.2.2-rc.1",
|
|
112
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.1",
|
|
113
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.1",
|
|
114
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
|
|
114
115
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
115
116
|
"@types/node": "^22.20.0",
|
|
116
117
|
"@types/react": "~18.3.1",
|