@waterwx/dsh-novel-forge 1.2.0 → 1.3.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/README.md +5 -0
- package/lib/client.js +2100 -651
- package/lib/client.js.map +1 -1
- package/lib/index.js +567 -173
- package/lib/index.js.map +1 -1
- package/lib/types/client/api.d.ts +4 -4
- package/lib/types/client/panel/NovelPanel.d.ts +1 -1
- package/lib/types/comic-presets.d.ts +12 -0
- package/lib/types/engine.d.ts +16 -13
- package/lib/types/index.d.ts +6 -0
- package/lib/types/protocol.d.ts +128 -89
- package/package.json +2 -1
- package/scripts/assistant-frames.txt +8 -0
- package/scripts/diagnose-adapter.mts +81 -0
- package/scripts/diagnose-assistant.mjs +58 -0
- package/scripts/diagnose-bible.mjs +72 -0
- package/scripts/diagnose-harness.mts +75 -0
- package/scripts/novel-forge-restart.log +10 -0
- package/scripts/novel-forge-web.stderr.log +2 -0
- package/scripts/novel-forge-web.stdout.log +1 -0
- package/scripts/outline-sample.txt +449 -0
- package/scripts/patch-schemastery.mjs +47 -0
- package/scripts/probe.mjs +6 -0
- package/scripts/restart-web.ps1 +88 -0
- package/scripts/smoke.mts +72 -0
- package/scripts/upload-github.ps1 +51 -0
- package/src/client/api.ts +10 -10
- package/src/client/panel/NovelPanel.tsx +650 -172
- package/src/comic-presets.ts +67 -0
- package/src/engine.ts +344 -188
- package/src/index.ts +15 -0
- package/src/protocol.ts +121 -96
- package/src/routes.ts +173 -52
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Upload the dsh-novel-forge project to GitHub via the Contents API.
|
|
2
|
+
# Uses the current token (passed as $env:GH_TOKEN) — one PUT per file,
|
|
3
|
+
# directories are created implicitly. Retries transient failures once.
|
|
4
|
+
param(
|
|
5
|
+
[string]$Owner = "watersxya",
|
|
6
|
+
[string]$Repo = "dsh-novel-forge",
|
|
7
|
+
[string]$SourceDir = "C:\Users\Ryan\Desktop\ai xiaoshuo",
|
|
8
|
+
[string]$Branch = "main"
|
|
9
|
+
)
|
|
10
|
+
$ErrorActionPreference = 'Stop'
|
|
11
|
+
$token = $env:GH_TOKEN
|
|
12
|
+
if ([string]::IsNullOrEmpty($token)) { Write-Host "GH_TOKEN env var required"; exit 1 }
|
|
13
|
+
$headers = @{
|
|
14
|
+
Authorization = "Bearer $token"
|
|
15
|
+
'User-Agent' = 'dsh-novel-forge-uploader'
|
|
16
|
+
'X-GitHub-Api-Version' = '2022-11-28'
|
|
17
|
+
}
|
|
18
|
+
$base = "https://api.github.com/repos/$Owner/$Repo/contents"
|
|
19
|
+
$files = Get-ChildItem $SourceDir -Recurse -File
|
|
20
|
+
$log = Join-Path $SourceDir 'upload-log.txt'
|
|
21
|
+
"=== upload started $(Get-Date) ===" | Set-Content $log -Encoding UTF8
|
|
22
|
+
$ok = 0; $failed = 0
|
|
23
|
+
foreach ($file in $files) {
|
|
24
|
+
$rel = $file.FullName.Substring($SourceDir.Length + 1).Replace('\', '/')
|
|
25
|
+
$bytes = [System.IO.File]::ReadAllBytes($file.FullName)
|
|
26
|
+
$contentB64 = [System.Convert]::ToBase64String($bytes)
|
|
27
|
+
$body = @{ message = "Add $rel"; content = $contentB64; branch = $Branch } | ConvertTo-Json
|
|
28
|
+
$done = $false
|
|
29
|
+
for ($attempt = 1; $attempt -le 2 -and -not $done; $attempt++) {
|
|
30
|
+
try {
|
|
31
|
+
$null = Invoke-RestMethod -Uri "$base/$rel" -Headers $headers -Method PUT -Body $body -ContentType "application/json" -TimeoutSec 60
|
|
32
|
+
$done = $true
|
|
33
|
+
$ok++
|
|
34
|
+
"[OK] $rel" | Add-Content $log -Encoding UTF8
|
|
35
|
+
} catch {
|
|
36
|
+
$resp = $_.Exception.Response
|
|
37
|
+
$status = if ($resp) { [int]$resp.StatusCode } else { 0 }
|
|
38
|
+
if ($attempt -eq 2 -or $status -ne 502 -and $status -ne 503) {
|
|
39
|
+
$msg = if ($resp) { (New-Object System.IO.StreamReader($resp.GetResponseStream())).ReadToEnd() } else { $_.Exception.Message }
|
|
40
|
+
$failed++
|
|
41
|
+
"[FAIL] $rel -> HTTP $status $msg" | Add-Content $log -Encoding UTF8
|
|
42
|
+
Write-Host "[FAIL] $rel -> HTTP $status"
|
|
43
|
+
break
|
|
44
|
+
}
|
|
45
|
+
Start-Sleep -Seconds 3
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if ($done) { Write-Host "[OK] $rel" }
|
|
49
|
+
}
|
|
50
|
+
"=== done: ok=$ok failed=$failed ===" | Add-Content $log -Encoding UTF8
|
|
51
|
+
Write-Host "=== done: ok=$ok failed=$failed ==="
|
package/src/client/api.ts
CHANGED
|
@@ -85,16 +85,6 @@ export class NovelApi {
|
|
|
85
85
|
return postJson<import('../protocol.ts').BreakdownResponse>(NOVEL_API.breakdown, { scope, preset, budgetTokens })
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/** 漫剧分镜生成:章节 → 角色锚点 + 分镜表。 */
|
|
89
|
-
async storyboard(chapterNo: number, genre?: string, platform?: string, tool?: string): Promise<import('../protocol.ts').StoryboardResponse> {
|
|
90
|
-
return postJson<import('../protocol.ts').StoryboardResponse>(NOVEL_API.storyboard, { chapterNo, genre, platform, tool })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** 漫剧分集计划:读一卷 → 按故事弧线分集。 */
|
|
94
|
-
async storyboardPlan(volumeNo: number, platform?: string, maxEpisodes?: number): Promise<import('../protocol.ts').StoryboardPlanResponse> {
|
|
95
|
-
return postJson<import('../protocol.ts').StoryboardPlanResponse>(NOVEL_API.storyboardPlan, { volumeNo, platform, maxEpisodes })
|
|
96
|
-
}
|
|
97
|
-
|
|
98
88
|
async plan(outline?: string, chapterCount?: number, volume?: number): Promise<PlanResponse> {
|
|
99
89
|
return postJson<PlanResponse>(NOVEL_API.plan, { outline, chapterCount, volume })
|
|
100
90
|
}
|
|
@@ -217,6 +207,16 @@ export class NovelApi {
|
|
|
217
207
|
return postJson<import('../protocol.ts').RolesResponse>(NOVEL_API.roles, req)
|
|
218
208
|
}
|
|
219
209
|
|
|
210
|
+
/** 场景库:AI 提炼 / 采纳 / 更新 / 删除 / 图集。 */
|
|
211
|
+
async scenes(req: import('../protocol.ts').ScenesRequest): Promise<import('../protocol.ts').ScenesResponse> {
|
|
212
|
+
return postJson<import('../protocol.ts').ScenesResponse>(NOVEL_API.scenes, req)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** 视觉世界观规则:提炼 / 保存。 */
|
|
216
|
+
async visualRules(req: import('../protocol.ts').VisualRulesRequest): Promise<import('../protocol.ts').VisualRulesResponse> {
|
|
217
|
+
return postJson<import('../protocol.ts').VisualRulesResponse>(NOVEL_API.visualRules, req)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
220
|
/** 小说简介:AI 生成/补全(partial 留空 = 全量),或手动保存。 */
|
|
221
221
|
async blurb(action: 'generate' | 'save', text?: string, partial?: string): Promise<{ blurb: string }> {
|
|
222
222
|
return postJson<{ blurb: string }>(NOVEL_API.blurb, { action, text, partial })
|