@dsh-agentic-roleplay/core 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{authoring-tools-CdHlvx32.js → authoring-tools-C_l07RYn.js} +1168 -509
- package/lib/authoring.js +22 -18
- package/lib/client.js +338 -338
- package/lib/doctor.js +1 -1
- package/lib/{gallery-BKh7eu80.js → gallery-q7niLtWn.js} +2 -2
- package/lib/{generator-DdZ1-sgv.js → generator-BpjPrvHe.js} +2 -2
- package/lib/{hooks-CcQj_dJo.js → hooks-DNaDzMjW.js} +37 -4
- package/lib/images.js +4 -4
- package/lib/index.js +12 -12
- package/lib/{library-QFL6Z_Nr.js → library-CIkxhf_R.js} +4 -2
- package/lib/{lorebook-author-tools-DWBnYo1E.js → lorebook-author-tools-BiMDmdFi.js} +5 -5
- package/lib/lorebook-authoring.js +4 -4
- package/lib/orchestration.js +7 -7
- package/lib/{pack-jail-BMy6NcCY.js → pack-jail-B35Vx3hT.js} +23 -13
- package/lib/{packs-BREPSfHy.js → packs-BajKw7S9.js} +2 -2
- package/lib/{presenter-agent-B49-_iUm.js → presenter-agent-jgtuTwZr.js} +4 -4
- package/lib/{preset-BqgY1Tz4.js → preset-DWgkcPau.js} +3 -3
- package/lib/{preset-author-tools-BB_Dcv2o.js → preset-author-tools-BhuYIKms.js} +5 -5
- package/lib/preset-authoring.js +5 -5
- package/lib/{presets-Bwnrx7p0.js → presets-9GzaSELc.js} +13 -4
- package/lib/{reflection-CUWG-6Qg.js → reflection-4L0Plvct.js} +5 -5
- package/lib/{turn-guard-Bb8Ew-1z.js → turn-guard-sCUXmp-5.js} +2 -2
- package/package.json +2 -2
- package/prompts/en/checks/conflict.md +1 -0
- package/prompts/en/checks/decide-conflict.md +1 -0
- package/prompts/en/checks/decide-covered.md +1 -0
- package/prompts/en/checks/decide-opening.md +1 -0
- package/prompts/en/checks/decide-same-thing.md +1 -0
- package/prompts/en/checks/decide-same-value.md +1 -0
- package/prompts/en/checks/notice.md +2 -2
- package/prompts/zh/checks/conflict.md +1 -0
- package/prompts/zh/checks/decide-conflict.md +1 -0
- package/prompts/zh/checks/decide-covered.md +1 -0
- package/prompts/zh/checks/decide-opening.md +1 -0
- package/prompts/zh/checks/decide-same-thing.md +1 -0
- package/prompts/zh/checks/decide-same-value.md +1 -0
- package/prompts/zh/checks/notice.md +2 -2
package/lib/authoring.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as cardTools, C as
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { C as readWorldEditor, L as presetTools, M as deleteTriggerDocument, N as readTriggerDocuments, P as writeTriggerDocument, U as finishUpdate, W as pendingUpdate, _ as editWorldPlots, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, i as checkWorldPack, l as deleteAuthoredEntity, o as listWorldPacks, r as registerPackJail, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument, v as editWorldRelation, z as translateTools } from "./pack-jail-
|
|
4
|
-
import { Dt as InvalidEditProblems, G as listWorldPrompts, K as readWorldPrompt, Mt as parseRelationEdit, Q as IMPORT_FOLDER, U as PROSE_PROMPTS, W as deleteWorldPrompt, ct as parseAuthoringCommand, q as writeWorldPrompt } from "./presets-
|
|
1
|
+
import { A as cardTools, C as readWorldInfo, E as loadCardEvidence, F as editsSince, M as readSource, N as CHECK_COMMANDS, S as editWorldInfo, T as loadWorldParts, _ as runChecks, a as importHooks, b as matchPieces, g as CHECKS, h as presentReport, ht as checkWorld, i as contextOf, in as authoredWorldOf, j as entitiesByPiece, l as isReviewing, m as checkImported, n as limitAuthoringAgents, o as importTools, tt as parseWorldInfoEdit, v as cardChanges, x as worldFieldChanges, y as diffText } from "./authoring-tools-C_l07RYn.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-sCUXmp-5.js";
|
|
3
|
+
import { C as readWorldEditor, L as presetTools, M as deleteTriggerDocument, N as readTriggerDocuments, P as writeTriggerDocument, U as finishUpdate, W as pendingUpdate, _ as editWorldPlots, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, i as checkWorldPack, l as deleteAuthoredEntity, o as listWorldPacks, r as registerPackJail, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument, v as editWorldRelation, z as translateTools } from "./pack-jail-B35Vx3hT.js";
|
|
4
|
+
import { Dt as InvalidEditProblems, G as listWorldPrompts, K as readWorldPrompt, Mt as parseRelationEdit, Q as IMPORT_FOLDER, U as PROSE_PROMPTS, W as deleteWorldPrompt, ct as parseAuthoringCommand, q as writeWorldPrompt } from "./presets-9GzaSELc.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
|
|
6
|
-
import { J as formatIssue, V as parsePlotsFile, at as shippedPromptsDirectory } from "./hooks-
|
|
7
|
-
import { g as SURFACE_NAMES, m as PACK_LIMITS, p as PACK_ACTIONS } from "./packs-
|
|
6
|
+
import { J as formatIssue, V as parsePlotsFile, at as shippedPromptsDirectory } from "./hooks-DNaDzMjW.js";
|
|
7
|
+
import { g as SURFACE_NAMES, m as PACK_LIMITS, p as PACK_ACTIONS } from "./packs-BajKw7S9.js";
|
|
8
8
|
import "./access-CfQWbNZP.js";
|
|
9
9
|
import { join, relative } from "node:path";
|
|
10
10
|
import { readFile, readdir } from "node:fs/promises";
|
|
@@ -514,7 +514,7 @@ function sizeOf(text) {
|
|
|
514
514
|
zh: `${text.length} 个字符,开头:${clip(text, 70)}`
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
|
-
function plain(value, max = 220) {
|
|
517
|
+
function plain$1(value, max = 220) {
|
|
518
518
|
const text = clip(value, max);
|
|
519
519
|
return {
|
|
520
520
|
en: text,
|
|
@@ -641,7 +641,7 @@ function authoredWorldWriteTools(reader) {
|
|
|
641
641
|
id: record.summary.id,
|
|
642
642
|
directory: record.directory
|
|
643
643
|
};
|
|
644
|
-
await createAuthoredEntity(world, args.kind, args.key, args.document);
|
|
644
|
+
await createAuthoredEntity(world, args.kind, args.key, args.document, { refuseUnread: true });
|
|
645
645
|
return result("created", args.kind, args.key, await readWorldEditor(world));
|
|
646
646
|
}
|
|
647
647
|
}),
|
|
@@ -664,7 +664,7 @@ function authoredWorldWriteTools(reader) {
|
|
|
664
664
|
id: record.summary.id,
|
|
665
665
|
directory: record.directory
|
|
666
666
|
};
|
|
667
|
-
await replaceAuthoredEntity(world, args.kind, args.key, args.document);
|
|
667
|
+
await replaceAuthoredEntity(world, args.kind, args.key, args.document, { refuseUnread: true });
|
|
668
668
|
return result("replaced", args.kind, args.key, await readWorldEditor(world));
|
|
669
669
|
}
|
|
670
670
|
}),
|
|
@@ -872,9 +872,9 @@ async function infoDetail(changes, before) {
|
|
|
872
872
|
try {
|
|
873
873
|
edit = parseWorldInfoEdit(changes);
|
|
874
874
|
} catch {
|
|
875
|
-
return plain(changes);
|
|
875
|
+
return plain$1(changes);
|
|
876
876
|
}
|
|
877
|
-
return before === void 0 ? plain(edit) : changedFields(before, {
|
|
877
|
+
return before === void 0 ? plain$1(edit) : changedFields(before, {
|
|
878
878
|
...before,
|
|
879
879
|
...edit
|
|
880
880
|
});
|
|
@@ -897,7 +897,7 @@ async function detailOf(exec, kind, key, current) {
|
|
|
897
897
|
const before = exec.agent === void 0 ? void 0 : await current?.(exec.agent.session.id, kind, key);
|
|
898
898
|
return before === void 0 ? createdFields(args["document"]) : changedFields(before, args["document"]);
|
|
899
899
|
}
|
|
900
|
-
case "edit_world_relationship": return plain(args["change"]);
|
|
900
|
+
case "edit_world_relationship": return plain$1(args["change"]);
|
|
901
901
|
case "replace_world_plots": return Array.isArray(args["plots"]) ? {
|
|
902
902
|
en: `${args["plots"].length} plots`,
|
|
903
903
|
zh: `${args["plots"].length} 条剧情`
|
|
@@ -1099,6 +1099,8 @@ const output = {
|
|
|
1099
1099
|
text: JSON.stringify(value, null, 2)
|
|
1100
1100
|
}]
|
|
1101
1101
|
};
|
|
1102
|
+
/** A value as the tool result carries it: plain data. */
|
|
1103
|
+
const plain = (value) => JSON.parse(JSON.stringify(value));
|
|
1102
1104
|
const deepParameter = {
|
|
1103
1105
|
type: "boolean",
|
|
1104
1106
|
description: "Also run the checks a model judges (slower, one or more model requests each). Leave it off for a quick look; turn it on when the quick checks leave the world looking thin, when the person asks for a thorough check, or before you say an import is done."
|
|
@@ -1133,16 +1135,17 @@ function kitTool(reader, judging, name, kit, description, card = false) {
|
|
|
1133
1135
|
kits: [kit],
|
|
1134
1136
|
deep: args.deep === true
|
|
1135
1137
|
});
|
|
1136
|
-
return
|
|
1138
|
+
return plain(presentReport(report));
|
|
1137
1139
|
}
|
|
1138
1140
|
});
|
|
1139
1141
|
}
|
|
1140
1142
|
/** The checks of the suite as tools of a world authoring chat; each kit is one call, and what it finds is stored with the world for the next run to compare with. */
|
|
1141
1143
|
function checkTools(reader, judging) {
|
|
1142
1144
|
return [
|
|
1143
|
-
kitTool(reader, judging, "check_world", "consistency", "Check the world for inconsistencies: whether a story could start from it (every file reads and everything that refers to something refers to something that is there; it names the problems of the first part of the world that has any, so run it again after fixing them), places no one can reach, names that clash, tracked values that are the same thing twice, and prompts the story could not use. Run it before you say a world is done. It reads only; each finding says where it is and, when clear, what would fix it."),
|
|
1144
|
-
kitTool(reader, judging, "check_card", "fidelity", "Compare the world with the card it was imported from, which is kept: whether every piece of the card the import read is in the world, whether every name in the world occurs in the card, whether the numbers the card gives were kept, and, with version new, what a newer card waiting to update the world changed that the world does not say yet. With deep, a model also compares each document with the pieces it was made from and quotes the facts that were lost or made up. A finding is a pointer: read the piece with card_read before you change anything. It reads only.", true),
|
|
1145
|
+
kitTool(reader, judging, "check_world", "consistency", "Check the world for inconsistencies: whether a story could start from it (every file reads and everything that refers to something refers to something that is there; it names the problems of the first part of the world that has any, so run it again after fixing them), places no one can reach, names that clash, tracked values that are the same thing twice, and prompts the story could not use. With deep, tracked values, characters, places and things that are the same under different words, and background entries that contradict each other, are found by meaning (with quoted passages for contradictions). Run it before you say a world is done. It reads only; each finding says where it is and, when clear, what would fix it."),
|
|
1146
|
+
kitTool(reader, judging, "check_card", "fidelity", "Compare the world with the card it was imported from, which is kept: whether every piece of the card the import read is in the world, whether every name in the world occurs in the card, whether the numbers the card gives were kept, and, with version new, what a newer card waiting to update the world changed that the world does not say yet. With deep, a model also compares each document with the pieces it was made from and quotes the facts that were lost or made up, and a piece that shares no words with the world (another language, a rewrite) is looked for by meaning before it is called lost. A finding is a pointer: read the piece with card_read before you change anything. It reads only.", true),
|
|
1145
1147
|
kitTool(reader, judging, "check_quality", "quality", "Check the authoring quality of the world: whether someone can be played, whether the characters that matter have sheets to play from, places with nothing in them, what the world says about itself. With deep, a model also judges whether each sheet is enough to play and what the world is missing to play well. It reads only; a finding is a gap to fill from what the card or the person says, never from invention."),
|
|
1148
|
+
kitTool(reader, judging, "check_play", "playability", "Check whether a story can begin well from this world: for each character the player may play, whether the place they start in has ways out, people and things, and, with deep, whether a model reading the opening and that first scene finds something the player can do. It reads only; a finding is a gap in the first scene to fill from what the card or the person says, never from invention."),
|
|
1146
1149
|
defineTool({
|
|
1147
1150
|
name: "check_list",
|
|
1148
1151
|
description: "List the checks of the suite: which kit each belongs to, whether the program or a model decides it, and what it needs.",
|
|
@@ -1150,13 +1153,13 @@ function checkTools(reader, judging) {
|
|
|
1150
1153
|
output,
|
|
1151
1154
|
isConcurrencySafe: () => true,
|
|
1152
1155
|
async execute() {
|
|
1153
|
-
return
|
|
1156
|
+
return plain(CHECKS.map((check) => ({
|
|
1154
1157
|
id: check.id,
|
|
1155
1158
|
kit: check.kit,
|
|
1156
1159
|
mode: check.mode,
|
|
1157
1160
|
needs: check.needs,
|
|
1158
1161
|
description: check.description
|
|
1159
|
-
})))
|
|
1162
|
+
})));
|
|
1160
1163
|
}
|
|
1161
1164
|
})
|
|
1162
1165
|
];
|
|
@@ -1166,7 +1169,8 @@ function checkTools(reader, judging) {
|
|
|
1166
1169
|
const KIT_TOOLS = {
|
|
1167
1170
|
consistency: "check_world",
|
|
1168
1171
|
fidelity: "check_card",
|
|
1169
|
-
quality: "check_quality"
|
|
1172
|
+
quality: "check_quality",
|
|
1173
|
+
playability: "check_play"
|
|
1170
1174
|
};
|
|
1171
1175
|
/** Hears the check commands (`/check`, `/check-world`) in an authoring chat and tells the assistant to run those kits and what to do with what they find. */
|
|
1172
1176
|
function checkHooks(ctx, prompting) {
|