dsh-yanfield 0.1.7 → 0.1.8
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/dist/client.js +94 -92
- package/dist/host.js +63 -4
- package/package.json +1 -1
package/dist/host.js
CHANGED
|
@@ -17341,7 +17341,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
17341
17341
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
17342
17342
|
|
|
17343
17343
|
// package.json
|
|
17344
|
-
var version = "0.1.
|
|
17344
|
+
var version = "0.1.8";
|
|
17345
17345
|
|
|
17346
17346
|
// src/host.ts
|
|
17347
17347
|
import fs2 from "node:fs";
|
|
@@ -19236,6 +19236,7 @@ var editor = {
|
|
|
19236
19236
|
"\u4E0A\u4E00\u4E2A": "Previous",
|
|
19237
19237
|
"\u4E0A\u4E00\u4E2A (Shift+Enter)": "Previous (Shift+Enter)",
|
|
19238
19238
|
"\u4E0A\u4E00\u5904": "Previous change",
|
|
19239
|
+
"\u5B9A\u4F4D\u6539\u52A8": "Go to change",
|
|
19239
19240
|
"\u4E0A\u4E00\u7AE0": "Previous chapter",
|
|
19240
19241
|
"\u4E0A\u4E00\u7AE0\uFF1A{title}": "Previous chapter: {title}",
|
|
19241
19242
|
"\u4E0A\u6B21\u79BB\u5F00\u65F6\u672A\u80FD\u786E\u8BA4\u4FDD\u5B58\u3002\u6570\u636E\u5E93\u5185\u5BB9\u53EF\u80FD\u5DF2\u7ECF\u53D8\u5316\uFF1B\u6062\u590D\u540E\u8BF7\u6838\u5BF9\uFF0C\u4FDD\u5B58\u4F1A\u8986\u76D6\u5F53\u524D\u7AE0\u8282\u3002\u4E34\u65F6\u8349\u7A3F\u53EA\u4FDD\u5B58\u5728\u6B64\u6D4F\u89C8\u5668\u6807\u7B7E\u9875\u4E2D\uFF0C\u4E0D\u80FD\u4EE3\u66FF\u5907\u4EFD\u3002": "Your last session ended before the save was confirmed. The database may have changed since; check the restored text, because saving will overwrite the current chapter. The temporary draft lives only in this browser tab and is no substitute for a backup.",
|
|
@@ -19923,6 +19924,7 @@ var ai = {
|
|
|
19923
19924
|
"\u7528\u91CF\u52A0\u8F7D\u4E2D": "Loading usage",
|
|
19924
19925
|
"\u7531\u6A21\u578B\u51B3\u5B9A": "Model default",
|
|
19925
19926
|
"\u6709\u65B0\u8FDB\u5C55 \xB7 \u56DE\u5230\u5E95\u90E8 \u2193": "New updates \xB7 Back to bottom \u2193",
|
|
19927
|
+
"\u5BF9\u8BDD\u6D88\u606F": "Chat messages",
|
|
19926
19928
|
"\u4F59\u989D": "Balance",
|
|
19927
19929
|
"\u4F59\u989D {amount}": "Balance {amount}",
|
|
19928
19930
|
"\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5": "Failed to check balance; try again later",
|
|
@@ -43141,7 +43143,15 @@ function date4(params) {
|
|
|
43141
43143
|
var text = external_exports.string().max(1e5);
|
|
43142
43144
|
var name = external_exports.string().trim().min(1).max(200);
|
|
43143
43145
|
var list = external_exports.array(external_exports.string().max(5e3)).max(100);
|
|
43144
|
-
var scene = external_exports.object({
|
|
43146
|
+
var scene = external_exports.object({
|
|
43147
|
+
id: external_exports.string(),
|
|
43148
|
+
title: text,
|
|
43149
|
+
summary: text,
|
|
43150
|
+
purpose: text,
|
|
43151
|
+
emotion: text,
|
|
43152
|
+
characters: list.describe("Names as the author writes them. Use names in this text field."),
|
|
43153
|
+
location: text.describe("Place name as the author writes it. Use the name in this text field.")
|
|
43154
|
+
});
|
|
43145
43155
|
var patchSchemas = {
|
|
43146
43156
|
chapter: external_exports.object({ title: name, content: text, summary: text, notes: text, volumeId: external_exports.string().nullable(), orderIndex: external_exports.number().int().nonnegative() }).partial().strict(),
|
|
43147
43157
|
blueprint: external_exports.object({ goal: text, pov: text, conflict: text, emotionalArc: text, scenes: external_exports.array(scene).max(30), plotPoints: list, hooks: list, suspense: external_exports.enum(["low", "medium", "high"]), twist: external_exports.enum(["low", "medium", "high"]), targetWords: external_exports.number().int().min(100).max(2e4), notes: text }).partial().strict(),
|
|
@@ -43367,8 +43377,54 @@ function applyBlockDiff(beforeHtml, diff, acceptedIds) {
|
|
|
43367
43377
|
return out.filter(Boolean).join("");
|
|
43368
43378
|
}
|
|
43369
43379
|
|
|
43380
|
+
// src/yanfield/lib/ai/agent/links.ts
|
|
43381
|
+
var linkFields = {
|
|
43382
|
+
chapter: { volumeId: { kind: "volume", label: "\u6240\u5C5E\u5377" } },
|
|
43383
|
+
world: { parentId: { kind: "world", label: "\u6240\u5C5E\u8BBE\u5B9A" } },
|
|
43384
|
+
location: { parentId: { kind: "location", label: "\u4E0A\u7EA7\u5730\u70B9" } },
|
|
43385
|
+
foreshadow: {
|
|
43386
|
+
plantedChapterId: { kind: "chapter", label: "\u57CB\u8BBE\u7AE0\u8282" },
|
|
43387
|
+
payoffChapterId: { kind: "chapter", label: "\u56DE\u6536\u7AE0\u8282" }
|
|
43388
|
+
}
|
|
43389
|
+
};
|
|
43390
|
+
function agentLinkField(kind, field) {
|
|
43391
|
+
const fields = linkFields[kind];
|
|
43392
|
+
return fields && Object.hasOwn(fields, field) ? fields[field] : void 0;
|
|
43393
|
+
}
|
|
43394
|
+
function agentLinkKey(kind, id2) {
|
|
43395
|
+
return `${kind}:${id2}`;
|
|
43396
|
+
}
|
|
43397
|
+
|
|
43370
43398
|
// src/yanfield/lib/ai/agent/store.ts
|
|
43399
|
+
var linkReaders = {
|
|
43400
|
+
chapter: getChapter,
|
|
43401
|
+
volume: getVolume,
|
|
43402
|
+
world: getWorld,
|
|
43403
|
+
location: getLocation
|
|
43404
|
+
};
|
|
43405
|
+
function withAgentLinkTitles(value) {
|
|
43406
|
+
const titles = { ...value.linkTitles };
|
|
43407
|
+
const seen = /* @__PURE__ */ new Set();
|
|
43408
|
+
for (const change of value.changes) {
|
|
43409
|
+
for (const field of Object.keys(change.after)) {
|
|
43410
|
+
const relation = agentLinkField(change.kind, field);
|
|
43411
|
+
if (!relation) continue;
|
|
43412
|
+
for (const id2 of [change.before?.[field], change.after[field]]) {
|
|
43413
|
+
if (typeof id2 !== "string" || !id2) continue;
|
|
43414
|
+
const key = agentLinkKey(relation.kind, id2);
|
|
43415
|
+
if (titles[key] || seen.has(key)) continue;
|
|
43416
|
+
seen.add(key);
|
|
43417
|
+
const row = linkReaders[relation.kind](id2);
|
|
43418
|
+
const reference = value.references.find((item) => item.kind === relation.kind && item.id === id2);
|
|
43419
|
+
const title = row?.novelId === value.novelId ? "name" in row ? row.name : row.title : reference?.title;
|
|
43420
|
+
if (title) titles[key] = title;
|
|
43421
|
+
}
|
|
43422
|
+
}
|
|
43423
|
+
}
|
|
43424
|
+
return Object.keys(titles).length ? { ...value, linkTitles: titles } : value;
|
|
43425
|
+
}
|
|
43371
43426
|
function saveRun(value) {
|
|
43427
|
+
if (value.status !== "running") value.linkTitles = withAgentLinkTitles(value).linkTitles;
|
|
43372
43428
|
value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
43373
43429
|
run("INSERT INTO agent_runs (id,novel_id,data,created_at) VALUES (?,?,?,?) ON CONFLICT(id) DO UPDATE SET data=excluded.data", [value.id, value.novelId, JSON.stringify(value), value.createdAt]);
|
|
43374
43430
|
}
|
|
@@ -43715,7 +43771,7 @@ var GET = handle(async (request, { params }) => {
|
|
|
43715
43771
|
const novelId = requireQueryParam(request, "novelId", "\u4F5C\u54C1");
|
|
43716
43772
|
const value = getRun(params.id);
|
|
43717
43773
|
if (value.novelId !== novelId) throw new ApiError("\u4EFB\u52A1\u4E0D\u5C5E\u4E8E\u8BE5\u4F5C\u54C1", 404);
|
|
43718
|
-
return ok(value);
|
|
43774
|
+
return ok(withAgentLinkTitles(value));
|
|
43719
43775
|
});
|
|
43720
43776
|
var PATCH = handle(async (request, { params }) => {
|
|
43721
43777
|
const body = await readBody(request), value = getRun(params.id);
|
|
@@ -46935,7 +46991,10 @@ async function* runTools(input2) {
|
|
|
46935
46991
|
try {
|
|
46936
46992
|
for await (const chunk of streamThoughts(run2, complete([...messages, ...outstanding], { tools: true }))) {
|
|
46937
46993
|
if (chunk.type === "agent-thinking") yield chunk;
|
|
46938
|
-
if (chunk.type === "delta")
|
|
46994
|
+
if (chunk.type === "delta") {
|
|
46995
|
+
text3 += chunk.text;
|
|
46996
|
+
yield chunk;
|
|
46997
|
+
}
|
|
46939
46998
|
if (chunk.type === "reasoning") reasoning += chunk.text;
|
|
46940
46999
|
if (chunk.type === "tool-calls") calls = chunk.calls;
|
|
46941
47000
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-yanfield",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A long-form fiction writing desk for DeepSeek Harness: manuscript, outline, story notes, and reviewable AI revisions. 在 DeepSeek Harness 里写长篇小说。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/host.js",
|