@dsh-agentic-roleplay/core 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cordis.patch.yml +108 -0
- package/lib/{access-DifaiHrI.js → access-Csp80TFX.js} +2 -2
- package/lib/{authoring-tools-VOaXzr_R.js → authoring-tools-BZr4bgBy.js} +9 -7
- package/lib/authoring.js +9 -8
- package/lib/{child-DzZ-aI6k.js → child-DTdY14S9.js} +45 -6
- package/lib/client.js +820 -561
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/{dev-context-Bdm-eVer.js → dev-context-Cgv_wZbG.js} +12 -2
- package/lib/doctor.js +5 -4
- package/lib/{gallery-Ctz-UoFk.js → gallery-BNg0rPTp.js} +3 -3
- package/lib/{generator-Cv6WWmZT.js → generator-9-5at9cZ.js} +2 -2
- package/lib/helper.js +4 -10
- package/lib/{hooks-BdR3mBeM.js → hooks-Dtq5KZQX.js} +19 -7
- package/lib/images.js +4 -4
- package/lib/index.js +39 -28
- package/lib/{jail-Cp4zEfip.js → jail-DVbPSC0R.js} +2 -2
- package/lib/{library-BU2A_Dx8.js → library-DTxakw0z.js} +2 -2
- package/lib/{lorebook-author-tools-DUKcQu8P.js → lorebook-author-tools-BjcEUo22.js} +6 -6
- package/lib/lorebook-authoring.js +7 -6
- package/lib/{narration-CDsJ5wxH.js → narration--K2XVIHI.js} +2 -2
- package/lib/orchestration.js +12 -12
- package/lib/{pack-jail-CzHQu0n3.js → pack-jail-Dt0VTsu0.js} +11 -11
- package/lib/{packs-BZ-45J4-.js → packs-DWfR2Ted.js} +2 -2
- package/lib/{presenter-agent-C2ZkoxZu.js → presenter-agent-vFOxIuWv.js} +6 -6
- package/lib/{preset-BPnRPW-1.js → preset-Dv5YF2qj.js} +4 -4
- package/lib/{preset-author-tools-DBqPwn-o.js → preset-author-tools-BUzO9mTW.js} +6 -6
- package/lib/preset-authoring.js +7 -6
- package/lib/{reflection-Cuy0YLv0.js → reflection-Dd3pEiZB.js} +7 -7
- package/lib/{serial-BZNeK57v.js → serial-BUaJGwVy.js} +67 -7
- package/lib/{turn-guard-xaFxYc1T.js → turn-guard-87NE-Cnp.js} +3 -3
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-
|
|
2
|
-
import { 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-
|
|
3
|
-
import { t as promptFor } from "./access-
|
|
4
|
-
import {
|
|
1
|
+
import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-DTdY14S9.js";
|
|
2
|
+
import { A as routeVerdicts, D as mergeReports, E as askYesNo, G as loadPreset, T as announceProblem, W as listPresets, X as sha, j as yesAt, k as noAt, t as SerialQueue } from "./serial-BUaJGwVy.js";
|
|
3
|
+
import { t as promptFor } from "./access-Csp80TFX.js";
|
|
4
|
+
import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, ht as describeWhen } from "./hooks-Dtq5KZQX.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import { s as inheritImages } from "./library-
|
|
7
|
-
import { i as inheritPacks } from "./packs-
|
|
6
|
+
import { s as inheritImages } from "./library-DTxakw0z.js";
|
|
7
|
+
import { i as inheritPacks } from "./packs-DWfR2Ted.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { characterKey, locationKey, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
|
|
10
10
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -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-Dd3pEiZB.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as parseSampling } from "./child-
|
|
2
|
-
import { f as parseSwitchboard } from "./narration
|
|
3
|
-
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-
|
|
4
|
-
import { G as readDocument, J as errorMessage, K as Reader, X as
|
|
1
|
+
import { m as parseSampling } from "./child-DTdY14S9.js";
|
|
2
|
+
import { f as parseSwitchboard } from "./narration--K2XVIHI.js";
|
|
3
|
+
import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-Csp80TFX.js";
|
|
4
|
+
import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-Dtq5KZQX.js";
|
|
5
5
|
import { i as translator, r as languageOf$1 } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-
|
|
6
|
+
import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-DTxakw0z.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";
|
|
@@ -2808,6 +2808,7 @@ const TEXT_FIELDS = [
|
|
|
2808
2808
|
"timeZone",
|
|
2809
2809
|
"startingTime",
|
|
2810
2810
|
"version",
|
|
2811
|
+
"language",
|
|
2811
2812
|
"preset"
|
|
2812
2813
|
];
|
|
2813
2814
|
const LIST_FIELDS = [
|
|
@@ -3113,6 +3114,9 @@ function parseWorldFile(text) {
|
|
|
3113
3114
|
const startQuestions = readStartQuestions(reader, alternateOpenings?.length ?? 0);
|
|
3114
3115
|
const narrationVoice = reader.string("narration_voice")?.trim() || void 0;
|
|
3115
3116
|
const sampling = readSampling(reader);
|
|
3117
|
+
const languageText = reader.string("language")?.trim() || void 0;
|
|
3118
|
+
if (languageText !== void 0 && !LANGUAGE_TAG.test(languageText)) reader.fail("language", "must be a language tag such as \"en\", \"zh\", \"ja\" or \"pt-BR\"");
|
|
3119
|
+
const language = languageText !== void 0 && LANGUAGE_TAG.test(languageText) ? languageOf(languageText) : void 0;
|
|
3116
3120
|
const preset = reader.string("preset")?.trim() || void 0;
|
|
3117
3121
|
if (preset !== void 0 && !isPresetName(preset)) reader.fail("preset", "must be the name of a preset: letters, digits, \"-\" and \"_\"");
|
|
3118
3122
|
const lorebooks = reader.strings("lorebooks").map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
@@ -3141,6 +3145,7 @@ function parseWorldFile(text) {
|
|
|
3141
3145
|
...startQuestions === void 0 ? {} : { startQuestions },
|
|
3142
3146
|
...narrationVoice === void 0 ? {} : { narrationVoice },
|
|
3143
3147
|
...sampling === void 0 ? {} : { sampling },
|
|
3148
|
+
...language === void 0 ? {} : { language },
|
|
3144
3149
|
...preset === void 0 ? {} : { preset },
|
|
3145
3150
|
...lorebooks.length === 0 ? {} : { lorebooks: [...new Set(lorebooks)] }
|
|
3146
3151
|
}
|
|
@@ -3960,6 +3965,9 @@ const CHARACTER_SCHEMA = {
|
|
|
3960
3965
|
};
|
|
3961
3966
|
/** The most things one character is given from what the text says it carries. */
|
|
3962
3967
|
const MAX_CARRIED = 12;
|
|
3968
|
+
const unplacedNote = (character, place) => `${character}: the place "${place}" is not one of the world's places, so the character starts nowhere`;
|
|
3969
|
+
/** Maximum inferred starting places created during one import. */
|
|
3970
|
+
const MAX_STARTING_PLACES = 3;
|
|
3963
3971
|
/** The document of a character file from what the call answered; names of places and characters become the keys they have in the roster. */
|
|
3964
3972
|
function characterDocument(entity, answer, roster) {
|
|
3965
3973
|
const notes = [];
|
|
@@ -3997,7 +4005,8 @@ function characterDocument(entity, answer, roster) {
|
|
|
3997
4005
|
["activity", "activity"]
|
|
3998
4006
|
]) put(start, to, text(given[from]));
|
|
3999
4007
|
const place = text(given["location"]) === "" ? void 0 : findEntity(roster, text(given["location"]), "place");
|
|
4000
|
-
|
|
4008
|
+
const unplaced = text(given["location"]) !== "" && place === void 0 ? text(given["location"]) : void 0;
|
|
4009
|
+
if (unplaced !== void 0) notes.push(unplacedNote(entity.name, unplaced));
|
|
4001
4010
|
if (place !== void 0) {
|
|
4002
4011
|
start["location"] = place.key;
|
|
4003
4012
|
put(start, "position", text(given["position"]));
|
|
@@ -4058,6 +4067,7 @@ function characterDocument(entity, answer, roster) {
|
|
|
4058
4067
|
return {
|
|
4059
4068
|
document,
|
|
4060
4069
|
notes,
|
|
4070
|
+
...unplaced === void 0 ? {} : { unplaced },
|
|
4061
4071
|
...carried.length === 0 ? {} : { carried }
|
|
4062
4072
|
};
|
|
4063
4073
|
}
|
|
@@ -4589,6 +4599,55 @@ function jobFor(text, tr, entity, sources, roster, card) {
|
|
|
4589
4599
|
}
|
|
4590
4600
|
};
|
|
4591
4601
|
}
|
|
4602
|
+
/** Creates missing places named by character starting locations. */
|
|
4603
|
+
async function startingPlaces(ctx, card, items, classified, roster, results) {
|
|
4604
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
4605
|
+
for (const { built } of results) {
|
|
4606
|
+
const name = built?.unplaced;
|
|
4607
|
+
if (name === void 0 || /[[\]{}]/.test(name) || name.length > 100 || roster.some((other) => other.kind === "character" && norm(other.name) === norm(name))) continue;
|
|
4608
|
+
const found = wanted.get(norm(name)) ?? {
|
|
4609
|
+
name,
|
|
4610
|
+
who: []
|
|
4611
|
+
};
|
|
4612
|
+
found.who.push(built);
|
|
4613
|
+
wanted.set(norm(name), found);
|
|
4614
|
+
}
|
|
4615
|
+
const made = [];
|
|
4616
|
+
const keys = new Set(roster.map((other) => other.key));
|
|
4617
|
+
for (const { name, who } of [...wanted.values()].slice(0, MAX_STARTING_PLACES)) {
|
|
4618
|
+
const entity = {
|
|
4619
|
+
kind: "place",
|
|
4620
|
+
key: uniqueKey(slug(name, "place"), keys),
|
|
4621
|
+
name,
|
|
4622
|
+
aliases: [],
|
|
4623
|
+
player: false
|
|
4624
|
+
};
|
|
4625
|
+
keys.add(entity.key);
|
|
4626
|
+
const known = [
|
|
4627
|
+
...roster,
|
|
4628
|
+
...made.map((each) => each.entity),
|
|
4629
|
+
entity
|
|
4630
|
+
];
|
|
4631
|
+
ctx.say(`writing place: ${name}`);
|
|
4632
|
+
try {
|
|
4633
|
+
const answer = await ctx.run(jobFor(ctx.text, trOf(ctx), entity, sourcesFor(entity, items, classified), known, card));
|
|
4634
|
+
made.push({
|
|
4635
|
+
entity,
|
|
4636
|
+
built: placeDocument(entity, answer, known)
|
|
4637
|
+
});
|
|
4638
|
+
} catch (error) {
|
|
4639
|
+
for (const character of who) character.notes.push(`${name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4640
|
+
continue;
|
|
4641
|
+
}
|
|
4642
|
+
for (const character of who) {
|
|
4643
|
+
const start = character.document["start"];
|
|
4644
|
+
start["location"] = entity.key;
|
|
4645
|
+
const at = character.notes.indexOf(unplacedNote(String(character.document["name"]), name));
|
|
4646
|
+
if (at >= 0) character.notes.splice(at, 1);
|
|
4647
|
+
}
|
|
4648
|
+
}
|
|
4649
|
+
return made;
|
|
4650
|
+
}
|
|
4592
4651
|
/** Makes the documents of every entity of the roster, and the lore from the pieces about the world. */
|
|
4593
4652
|
async function extractEntities(ctx, card, items, classified, roster) {
|
|
4594
4653
|
const result = emptyExtracted();
|
|
@@ -4613,6 +4672,7 @@ async function extractEntities(ctx, card, items, classified, roster) {
|
|
|
4613
4672
|
};
|
|
4614
4673
|
}
|
|
4615
4674
|
});
|
|
4675
|
+
entityResults.push(...await startingPlaces(ctx, card, items, classified, roster, entityResults));
|
|
4616
4676
|
for (const { entity, built, failure } of entityResults) {
|
|
4617
4677
|
if (failure !== void 0 || built === void 0) {
|
|
4618
4678
|
result.notes.push(failure ?? `${entity.name}: nothing was written`);
|
|
@@ -5140,4 +5200,4 @@ var SerialQueue = class {
|
|
|
5140
5200
|
};
|
|
5141
5201
|
export { deleteWorldPrompt as $, subfolders as $t, routeVerdicts as A, parseAuthoringCommand as At, createPresetFromGuidance as B, loadLore as Bt, ROLE_TABLE as C, PICTURE_FILE as Ct, mergeReports as D, writeChoices as Dt, askYesNo as E, readImportFolder as Et, parseWorldInfoEdit as F, VARIABLES_FILE_NAME as Ft, loadPreset as G, ITEM_FILE_NAME as Gt, deletePreset as H, parseLoreFile as Ht, combineAnswers as I, loadVariables as It, reservePreset as J, parseSlotsFile as Jt, presetDirectory as K, SLOTS_FILE_NAME as Kt, questionView as L, parseVariablesFile as Lt, WORLD_FILE_NAME as M, splitPanels as Mt, parseWorldFile as N, dialectOf as Nt, modeFor as O, IMPORT_COMMAND as Ot, MAX_OPENING_CHARS as P, sourceSummary as Pt, PROSE_PROMPTS as Q, parseCharacterFile as Qt, startQuestionsToFile as R, variableProblems as Rt, ROLES as S, ImportStore as St, announceProblem as T, parseChoices as Tt, isPresetName as U, LOCATION_FILE_NAME as Ut, createPresetFromShipped as V, LORE_FILE_NAME as Vt, listPresets as W, parseLocationFile as Wt, sha as X, parseFactionFile as Xt, savePresetFromWorld as Y, FACTION_FILE_NAME as Yt, updatePresetInfo as Z, CHARACTER_FILE_NAME as Zt, pruneRelationships as _, itemise as _t, characterDocument as a, parseRelationEdit as an, deleteLorebook as at, classifyItems as b, IMPORT_FOLDER as bt, extractStyle as c, LORE_KINDS as cn, isLorebookName as ct, inert as d, DEFAULT_SLOTS as dn, lorebookDirectory as dt, InvalidEditProblems as en, listWorldPrompts as et, loreDocuments as f, INTENT_STATUSES as fn, readLorebook as ft, pruneMembers as g, cleanText as gt, pruneLoreSubjects as h, writeLorebookEntry as ht, asWritten as i, parsePlaceEdit as in, createLorebook as it, yesAt as j, findPanel as jt, noAt as k, parseImportCommand as kt, extractStyleFrom as l, LORE_SCOPES as ln, listLorebooks as lt, pruneLinks as m, updateLorebookInfo as mt, STANDING_PROMPT as n, parseFactionEdit as nn, writeWorldPrompt as nt, emptyExtracted as o, parseThingEdit as on, deleteLorebookEntry as ot, pruneKnowledge as p, reserveLorebook as pt, readPreset as q, parseItemFile as qt, addLore as r, parseLoreEdit as rn, addLorebookEntries as rt, extractEntities as s, guarded as sn, entriesOf as st, SerialQueue as t, parseCharacterEdit as tn, readWorldPrompt as tt, extractVariables as u, WEEKDAY_NAMES as un, loadLorebook as ut, sourcesFor as v, partsOf as vt, isLeftOut as w, openingText as wt, findEntity as x, ImportNotFoundError as xt, buildRoster as y, withPlayer as yt, PRESET_FILE as z, LORE_DIR as zt };
|
|
5142
5202
|
|
|
5143
|
-
//# sourceMappingURL=serial-
|
|
5203
|
+
//# sourceMappingURL=serial-BUaJGwVy.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as finishOf, E as cutOff } from "./child-
|
|
2
|
-
import { r as guardRepeatedCalls } from "./hooks-
|
|
1
|
+
import { D as finishOf, E as cutOff } from "./child-DTdY14S9.js";
|
|
2
|
+
import { r as guardRepeatedCalls } from "./hooks-Dtq5KZQX.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-87NE-Cnp.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-agentic-roleplay/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
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,8 +80,7 @@
|
|
|
80
80
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@dsh-agentic-roleplay/state": "0.12.
|
|
84
|
-
"@dsh-ai-providers/core": "^0.7.0"
|
|
83
|
+
"@dsh-agentic-roleplay/state": "0.12.2"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
86
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
@@ -113,6 +112,7 @@
|
|
|
113
112
|
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.2.3",
|
|
114
113
|
"@deepseek-ai/dsh-user-approval": ">=0.2.2-rc.1 <0.2.3",
|
|
115
114
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
115
|
+
"@dsh-ai-providers/core": "^0.7.0",
|
|
116
116
|
"@types/node": "^22.20.0",
|
|
117
117
|
"@types/react": "~18.3.1",
|
|
118
118
|
"dsh-roleplay-model": "0.0.0",
|