@kienmatu/inkos-core 0.1.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/LICENSE +661 -0
- package/dist/agent/agent-session.d.ts +100 -0
- package/dist/agent/agent-session.d.ts.map +1 -0
- package/dist/agent/agent-session.js +1102 -0
- package/dist/agent/agent-session.js.map +1 -0
- package/dist/agent/agent-system-prompt.d.ts +12 -0
- package/dist/agent/agent-system-prompt.d.ts.map +1 -0
- package/dist/agent/agent-system-prompt.js +596 -0
- package/dist/agent/agent-system-prompt.js.map +1 -0
- package/dist/agent/agent-tools.d.ts +508 -0
- package/dist/agent/agent-tools.d.ts.map +1 -0
- package/dist/agent/agent-tools.js +3083 -0
- package/dist/agent/agent-tools.js.map +1 -0
- package/dist/agent/chapter-import-source.d.ts +16 -0
- package/dist/agent/chapter-import-source.d.ts.map +1 -0
- package/dist/agent/chapter-import-source.js +48 -0
- package/dist/agent/chapter-import-source.js.map +1 -0
- package/dist/agent/context-transform.d.ts +13 -0
- package/dist/agent/context-transform.d.ts.map +1 -0
- package/dist/agent/context-transform.js +183 -0
- package/dist/agent/context-transform.js.map +1 -0
- package/dist/agent/film-authoring-tools.d.ts +98 -0
- package/dist/agent/film-authoring-tools.d.ts.map +1 -0
- package/dist/agent/film-authoring-tools.js +405 -0
- package/dist/agent/film-authoring-tools.js.map +1 -0
- package/dist/agent/forecast-tools.d.ts +22 -0
- package/dist/agent/forecast-tools.d.ts.map +1 -0
- package/dist/agent/forecast-tools.js +153 -0
- package/dist/agent/forecast-tools.js.map +1 -0
- package/dist/agent/index.d.ts +8 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +8 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/llm-stub.d.ts +19 -0
- package/dist/agent/llm-stub.d.ts.map +1 -0
- package/dist/agent/llm-stub.js +134 -0
- package/dist/agent/llm-stub.js.map +1 -0
- package/dist/agent/pi-stream.d.ts +8 -0
- package/dist/agent/pi-stream.d.ts.map +1 -0
- package/dist/agent/pi-stream.js +31 -0
- package/dist/agent/pi-stream.js.map +1 -0
- package/dist/agent/skill-tool.d.ts +42 -0
- package/dist/agent/skill-tool.d.ts.map +1 -0
- package/dist/agent/skill-tool.js +279 -0
- package/dist/agent/skill-tool.js.map +1 -0
- package/dist/agent/worker-agent.d.ts +24 -0
- package/dist/agent/worker-agent.d.ts.map +1 -0
- package/dist/agent/worker-agent.js +288 -0
- package/dist/agent/worker-agent.js.map +1 -0
- package/dist/agents/ai-tells.d.ts +26 -0
- package/dist/agents/ai-tells.d.ts.map +1 -0
- package/dist/agents/ai-tells.js +140 -0
- package/dist/agents/ai-tells.js.map +1 -0
- package/dist/agents/architect.d.ts +78 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/architect.js +1184 -0
- package/dist/agents/architect.js.map +1 -0
- package/dist/agents/base.d.ts +42 -0
- package/dist/agents/base.d.ts.map +1 -0
- package/dist/agents/base.js +123 -0
- package/dist/agents/base.js.map +1 -0
- package/dist/agents/chapter-analyzer.d.ts +30 -0
- package/dist/agents/chapter-analyzer.d.ts.map +1 -0
- package/dist/agents/chapter-analyzer.js +509 -0
- package/dist/agents/chapter-analyzer.js.map +1 -0
- package/dist/agents/composer.d.ts +67 -0
- package/dist/agents/composer.d.ts.map +1 -0
- package/dist/agents/composer.js +936 -0
- package/dist/agents/composer.js.map +1 -0
- package/dist/agents/consolidator.d.ts +39 -0
- package/dist/agents/consolidator.d.ts.map +1 -0
- package/dist/agents/consolidator.js +179 -0
- package/dist/agents/consolidator.js.map +1 -0
- package/dist/agents/continuity.d.ts +45 -0
- package/dist/agents/continuity.d.ts.map +1 -0
- package/dist/agents/continuity.js +722 -0
- package/dist/agents/continuity.js.map +1 -0
- package/dist/agents/detection-insights.d.ts +9 -0
- package/dist/agents/detection-insights.d.ts.map +1 -0
- package/dist/agents/detection-insights.js +54 -0
- package/dist/agents/detection-insights.js.map +1 -0
- package/dist/agents/detector.d.ts +17 -0
- package/dist/agents/detector.d.ts.map +1 -0
- package/dist/agents/detector.js +77 -0
- package/dist/agents/detector.js.map +1 -0
- package/dist/agents/en-prompt-sections.d.ts +4 -0
- package/dist/agents/en-prompt-sections.d.ts.map +1 -0
- package/dist/agents/en-prompt-sections.js +9 -0
- package/dist/agents/en-prompt-sections.js.map +1 -0
- package/dist/agents/fanfic-canon-importer.d.ts +16 -0
- package/dist/agents/fanfic-canon-importer.d.ts.map +1 -0
- package/dist/agents/fanfic-canon-importer.js +164 -0
- package/dist/agents/fanfic-canon-importer.js.map +1 -0
- package/dist/agents/fanfic-dimensions.d.ts +14 -0
- package/dist/agents/fanfic-dimensions.d.ts.map +1 -0
- package/dist/agents/fanfic-dimensions.js +63 -0
- package/dist/agents/fanfic-dimensions.js.map +1 -0
- package/dist/agents/fanfic-prompt-sections.d.ts +5 -0
- package/dist/agents/fanfic-prompt-sections.d.ts.map +1 -0
- package/dist/agents/fanfic-prompt-sections.js +85 -0
- package/dist/agents/fanfic-prompt-sections.js.map +1 -0
- package/dist/agents/foundation-reviewer.d.ts +34 -0
- package/dist/agents/foundation-reviewer.d.ts.map +1 -0
- package/dist/agents/foundation-reviewer.js +174 -0
- package/dist/agents/foundation-reviewer.js.map +1 -0
- package/dist/agents/observer-prompts.d.ts +10 -0
- package/dist/agents/observer-prompts.d.ts.map +1 -0
- package/dist/agents/observer-prompts.js +113 -0
- package/dist/agents/observer-prompts.js.map +1 -0
- package/dist/agents/planner-context.d.ts +53 -0
- package/dist/agents/planner-context.d.ts.map +1 -0
- package/dist/agents/planner-context.js +238 -0
- package/dist/agents/planner-context.js.map +1 -0
- package/dist/agents/planner-prompts.d.ts +45 -0
- package/dist/agents/planner-prompts.d.ts.map +1 -0
- package/dist/agents/planner-prompts.js +391 -0
- package/dist/agents/planner-prompts.js.map +1 -0
- package/dist/agents/planner.d.ts +90 -0
- package/dist/agents/planner.d.ts.map +1 -0
- package/dist/agents/planner.js +715 -0
- package/dist/agents/planner.js.map +1 -0
- package/dist/agents/polisher.d.ts +33 -0
- package/dist/agents/polisher.d.ts.map +1 -0
- package/dist/agents/polisher.js +122 -0
- package/dist/agents/polisher.js.map +1 -0
- package/dist/agents/post-write-validator.d.ts +35 -0
- package/dist/agents/post-write-validator.d.ts.map +1 -0
- package/dist/agents/post-write-validator.js +758 -0
- package/dist/agents/post-write-validator.js.map +1 -0
- package/dist/agents/radar-source.d.ts +38 -0
- package/dist/agents/radar-source.d.ts.map +1 -0
- package/dist/agents/radar-source.js +92 -0
- package/dist/agents/radar-source.js.map +1 -0
- package/dist/agents/radar.d.ts +24 -0
- package/dist/agents/radar.d.ts.map +1 -0
- package/dist/agents/radar.js +85 -0
- package/dist/agents/radar.js.map +1 -0
- package/dist/agents/researcher.d.ts +38 -0
- package/dist/agents/researcher.d.ts.map +1 -0
- package/dist/agents/researcher.js +164 -0
- package/dist/agents/researcher.js.map +1 -0
- package/dist/agents/reviser.d.ts +35 -0
- package/dist/agents/reviser.d.ts.map +1 -0
- package/dist/agents/reviser.js +496 -0
- package/dist/agents/reviser.js.map +1 -0
- package/dist/agents/rules-reader.d.ts +32 -0
- package/dist/agents/rules-reader.d.ts.map +1 -0
- package/dist/agents/rules-reader.js +129 -0
- package/dist/agents/rules-reader.js.map +1 -0
- package/dist/agents/script-storyboard.d.ts +66 -0
- package/dist/agents/script-storyboard.d.ts.map +1 -0
- package/dist/agents/script-storyboard.js +657 -0
- package/dist/agents/script-storyboard.js.map +1 -0
- package/dist/agents/sensitive-words.d.ts +24 -0
- package/dist/agents/sensitive-words.d.ts.map +1 -0
- package/dist/agents/sensitive-words.js +103 -0
- package/dist/agents/sensitive-words.js.map +1 -0
- package/dist/agents/settler-delta-parser.d.ts +7 -0
- package/dist/agents/settler-delta-parser.d.ts.map +1 -0
- package/dist/agents/settler-delta-parser.js +40 -0
- package/dist/agents/settler-delta-parser.js.map +1 -0
- package/dist/agents/settler-parser.d.ts +13 -0
- package/dist/agents/settler-parser.d.ts.map +1 -0
- package/dist/agents/settler-parser.js +20 -0
- package/dist/agents/settler-parser.js.map +1 -0
- package/dist/agents/settler-prompts.d.ts +22 -0
- package/dist/agents/settler-prompts.d.ts.map +1 -0
- package/dist/agents/settler-prompts.js +195 -0
- package/dist/agents/settler-prompts.js.map +1 -0
- package/dist/agents/short-fiction.d.ts +120 -0
- package/dist/agents/short-fiction.d.ts.map +1 -0
- package/dist/agents/short-fiction.js +353 -0
- package/dist/agents/short-fiction.js.map +1 -0
- package/dist/agents/state-validator.d.ts +33 -0
- package/dist/agents/state-validator.d.ts.map +1 -0
- package/dist/agents/state-validator.js +262 -0
- package/dist/agents/state-validator.js.map +1 -0
- package/dist/agents/style-analyzer.d.ts +11 -0
- package/dist/agents/style-analyzer.d.ts.map +1 -0
- package/dist/agents/style-analyzer.js +98 -0
- package/dist/agents/style-analyzer.js.map +1 -0
- package/dist/agents/writer-parser.d.ts +17 -0
- package/dist/agents/writer-parser.d.ts.map +1 -0
- package/dist/agents/writer-parser.js +131 -0
- package/dist/agents/writer-parser.js.map +1 -0
- package/dist/agents/writer-prompts.d.ts +12 -0
- package/dist/agents/writer-prompts.d.ts.map +1 -0
- package/dist/agents/writer-prompts.js +495 -0
- package/dist/agents/writer-prompts.js.map +1 -0
- package/dist/agents/writer.d.ts +102 -0
- package/dist/agents/writer.d.ts.map +1 -0
- package/dist/agents/writer.js +882 -0
- package/dist/agents/writer.js.map +1 -0
- package/dist/forecast/agent.d.ts +22 -0
- package/dist/forecast/agent.d.ts.map +1 -0
- package/dist/forecast/agent.js +48 -0
- package/dist/forecast/agent.js.map +1 -0
- package/dist/forecast/context-builder.d.ts +35 -0
- package/dist/forecast/context-builder.d.ts.map +1 -0
- package/dist/forecast/context-builder.js +214 -0
- package/dist/forecast/context-builder.js.map +1 -0
- package/dist/forecast/prompts.d.ts +12 -0
- package/dist/forecast/prompts.d.ts.map +1 -0
- package/dist/forecast/prompts.js +114 -0
- package/dist/forecast/prompts.js.map +1 -0
- package/dist/forecast/render.d.ts +9 -0
- package/dist/forecast/render.d.ts.map +1 -0
- package/dist/forecast/render.js +154 -0
- package/dist/forecast/render.js.map +1 -0
- package/dist/forecast/runner.d.ts +51 -0
- package/dist/forecast/runner.d.ts.map +1 -0
- package/dist/forecast/runner.js +115 -0
- package/dist/forecast/runner.js.map +1 -0
- package/dist/forecast/schema.d.ts +767 -0
- package/dist/forecast/schema.d.ts.map +1 -0
- package/dist/forecast/schema.js +115 -0
- package/dist/forecast/schema.js.map +1 -0
- package/dist/forecast/store.d.ts +32 -0
- package/dist/forecast/store.d.ts.map +1 -0
- package/dist/forecast/store.js +129 -0
- package/dist/forecast/store.js.map +1 -0
- package/dist/index.d.ts +160 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +172 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/action-envelope.d.ts +1493 -0
- package/dist/interaction/action-envelope.d.ts.map +1 -0
- package/dist/interaction/action-envelope.js +257 -0
- package/dist/interaction/action-envelope.js.map +1 -0
- package/dist/interaction/book-session-store.d.ts +29 -0
- package/dist/interaction/book-session-store.d.ts.map +1 -0
- package/dist/interaction/book-session-store.js +185 -0
- package/dist/interaction/book-session-store.js.map +1 -0
- package/dist/interaction/draft-directive-parser.d.ts +38 -0
- package/dist/interaction/draft-directive-parser.d.ts.map +1 -0
- package/dist/interaction/draft-directive-parser.js +208 -0
- package/dist/interaction/draft-directive-parser.js.map +1 -0
- package/dist/interaction/edit-controller.d.ts +62 -0
- package/dist/interaction/edit-controller.d.ts.map +1 -0
- package/dist/interaction/edit-controller.js +381 -0
- package/dist/interaction/edit-controller.js.map +1 -0
- package/dist/interaction/events.d.ts +45 -0
- package/dist/interaction/events.d.ts.map +1 -0
- package/dist/interaction/events.js +32 -0
- package/dist/interaction/events.js.map +1 -0
- package/dist/interaction/export-artifact.d.ts +32 -0
- package/dist/interaction/export-artifact.d.ts.map +1 -0
- package/dist/interaction/export-artifact.js +103 -0
- package/dist/interaction/export-artifact.js.map +1 -0
- package/dist/interaction/intents.d.ts +99 -0
- package/dist/interaction/intents.d.ts.map +1 -0
- package/dist/interaction/intents.js +59 -0
- package/dist/interaction/intents.js.map +1 -0
- package/dist/interaction/modes.d.ts +5 -0
- package/dist/interaction/modes.d.ts.map +1 -0
- package/dist/interaction/modes.js +7 -0
- package/dist/interaction/modes.js.map +1 -0
- package/dist/interaction/project-control.d.ts +45 -0
- package/dist/interaction/project-control.d.ts.map +1 -0
- package/dist/interaction/project-control.js +71 -0
- package/dist/interaction/project-control.js.map +1 -0
- package/dist/interaction/project-session-store.d.ts +9 -0
- package/dist/interaction/project-session-store.d.ts.map +1 -0
- package/dist/interaction/project-session-store.js +64 -0
- package/dist/interaction/project-session-store.js.map +1 -0
- package/dist/interaction/project-tools.d.ts +23 -0
- package/dist/interaction/project-tools.d.ts.map +1 -0
- package/dist/interaction/project-tools.js +408 -0
- package/dist/interaction/project-tools.js.map +1 -0
- package/dist/interaction/request-router.d.ts +3 -0
- package/dist/interaction/request-router.d.ts.map +1 -0
- package/dist/interaction/request-router.js +5 -0
- package/dist/interaction/request-router.js.map +1 -0
- package/dist/interaction/runtime.d.ts +54 -0
- package/dist/interaction/runtime.d.ts.map +1 -0
- package/dist/interaction/runtime.js +919 -0
- package/dist/interaction/runtime.js.map +1 -0
- package/dist/interaction/session-transcript-legacy.d.ts +4 -0
- package/dist/interaction/session-transcript-legacy.d.ts.map +1 -0
- package/dist/interaction/session-transcript-legacy.js +102 -0
- package/dist/interaction/session-transcript-legacy.js.map +1 -0
- package/dist/interaction/session-transcript-restore.d.ts +18 -0
- package/dist/interaction/session-transcript-restore.d.ts.map +1 -0
- package/dist/interaction/session-transcript-restore.js +746 -0
- package/dist/interaction/session-transcript-restore.js.map +1 -0
- package/dist/interaction/session-transcript-schema.d.ts +435 -0
- package/dist/interaction/session-transcript-schema.d.ts.map +1 -0
- package/dist/interaction/session-transcript-schema.js +65 -0
- package/dist/interaction/session-transcript-schema.js.map +1 -0
- package/dist/interaction/session-transcript.d.ts +21 -0
- package/dist/interaction/session-transcript.d.ts.map +1 -0
- package/dist/interaction/session-transcript.js +164 -0
- package/dist/interaction/session-transcript.js.map +1 -0
- package/dist/interaction/session.d.ts +1194 -0
- package/dist/interaction/session.d.ts.map +1 -0
- package/dist/interaction/session.js +194 -0
- package/dist/interaction/session.js.map +1 -0
- package/dist/interaction/truth-authority.d.ts +4 -0
- package/dist/interaction/truth-authority.d.ts.map +1 -0
- package/dist/interaction/truth-authority.js +37 -0
- package/dist/interaction/truth-authority.js.map +1 -0
- package/dist/interactive-film/authoring-store.d.ts +35 -0
- package/dist/interactive-film/authoring-store.d.ts.map +1 -0
- package/dist/interactive-film/authoring-store.js +114 -0
- package/dist/interactive-film/authoring-store.js.map +1 -0
- package/dist/interactive-film/authoring-tools.d.ts +9 -0
- package/dist/interactive-film/authoring-tools.d.ts.map +1 -0
- package/dist/interactive-film/authoring-tools.js +19 -0
- package/dist/interactive-film/authoring-tools.js.map +1 -0
- package/dist/interactive-film/delta.d.ts +591 -0
- package/dist/interactive-film/delta.d.ts.map +1 -0
- package/dist/interactive-film/delta.js +54 -0
- package/dist/interactive-film/delta.js.map +1 -0
- package/dist/interactive-film/emotion.d.ts +20 -0
- package/dist/interactive-film/emotion.d.ts.map +1 -0
- package/dist/interactive-film/emotion.js +57 -0
- package/dist/interactive-film/emotion.js.map +1 -0
- package/dist/interactive-film/evaluator.d.ts +7 -0
- package/dist/interactive-film/evaluator.d.ts.map +1 -0
- package/dist/interactive-film/evaluator.js +40 -0
- package/dist/interactive-film/evaluator.js.map +1 -0
- package/dist/interactive-film/export-html.d.ts +6 -0
- package/dist/interactive-film/export-html.d.ts.map +1 -0
- package/dist/interactive-film/export-html.js +84 -0
- package/dist/interactive-film/export-html.js.map +1 -0
- package/dist/interactive-film/export-ink.d.ts +3 -0
- package/dist/interactive-film/export-ink.d.ts.map +1 -0
- package/dist/interactive-film/export-ink.js +51 -0
- package/dist/interactive-film/export-ink.js.map +1 -0
- package/dist/interactive-film/film-context.d.ts +4 -0
- package/dist/interactive-film/film-context.d.ts.map +1 -0
- package/dist/interactive-film/film-context.js +30 -0
- package/dist/interactive-film/film-context.js.map +1 -0
- package/dist/interactive-film/generate.d.ts +15 -0
- package/dist/interactive-film/generate.d.ts.map +1 -0
- package/dist/interactive-film/generate.js +51 -0
- package/dist/interactive-film/generate.js.map +1 -0
- package/dist/interactive-film/graph-schema.d.ts +819 -0
- package/dist/interactive-film/graph-schema.d.ts.map +1 -0
- package/dist/interactive-film/graph-schema.js +84 -0
- package/dist/interactive-film/graph-schema.js.map +1 -0
- package/dist/interactive-film/graph-store.d.ts +5 -0
- package/dist/interactive-film/graph-store.d.ts.map +1 -0
- package/dist/interactive-film/graph-store.js +24 -0
- package/dist/interactive-film/graph-store.js.map +1 -0
- package/dist/interactive-film/memory-link.d.ts +9 -0
- package/dist/interactive-film/memory-link.d.ts.map +1 -0
- package/dist/interactive-film/memory-link.js +15 -0
- package/dist/interactive-film/memory-link.js.map +1 -0
- package/dist/interactive-film/node-image.d.ts +29 -0
- package/dist/interactive-film/node-image.d.ts.map +1 -0
- package/dist/interactive-film/node-image.js +52 -0
- package/dist/interactive-film/node-image.js.map +1 -0
- package/dist/interactive-film/paths.d.ts +14 -0
- package/dist/interactive-film/paths.d.ts.map +1 -0
- package/dist/interactive-film/paths.js +60 -0
- package/dist/interactive-film/paths.js.map +1 -0
- package/dist/interactive-film/tool-schemas.d.ts +182 -0
- package/dist/interactive-film/tool-schemas.d.ts.map +1 -0
- package/dist/interactive-film/tool-schemas.js +125 -0
- package/dist/interactive-film/tool-schemas.js.map +1 -0
- package/dist/interactive-film/validation.d.ts +14 -0
- package/dist/interactive-film/validation.d.ts.map +1 -0
- package/dist/interactive-film/validation.js +292 -0
- package/dist/interactive-film/validation.js.map +1 -0
- package/dist/llm/agent-trajectory.d.ts +27 -0
- package/dist/llm/agent-trajectory.d.ts.map +1 -0
- package/dist/llm/agent-trajectory.js +74 -0
- package/dist/llm/agent-trajectory.js.map +1 -0
- package/dist/llm/config-migration.d.ts +5 -0
- package/dist/llm/config-migration.d.ts.map +1 -0
- package/dist/llm/config-migration.js +51 -0
- package/dist/llm/config-migration.js.map +1 -0
- package/dist/llm/cover-providers.d.ts +14 -0
- package/dist/llm/cover-providers.d.ts.map +1 -0
- package/dist/llm/cover-providers.js +51 -0
- package/dist/llm/cover-providers.js.map +1 -0
- package/dist/llm/long-form-completion.d.ts +16 -0
- package/dist/llm/long-form-completion.d.ts.map +1 -0
- package/dist/llm/long-form-completion.js +62 -0
- package/dist/llm/long-form-completion.js.map +1 -0
- package/dist/llm/provider.d.ts +110 -0
- package/dist/llm/provider.d.ts.map +1 -0
- package/dist/llm/provider.js +1405 -0
- package/dist/llm/provider.js.map +1 -0
- package/dist/llm/providers/endpoints/ai360.d.ts +10 -0
- package/dist/llm/providers/endpoints/ai360.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/ai360.js +34 -0
- package/dist/llm/providers/endpoints/ai360.js.map +1 -0
- package/dist/llm/providers/endpoints/anthropic.d.ts +12 -0
- package/dist/llm/providers/endpoints/anthropic.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/anthropic.js +72 -0
- package/dist/llm/providers/endpoints/anthropic.js.map +1 -0
- package/dist/llm/providers/endpoints/astronCodingPlan.d.ts +16 -0
- package/dist/llm/providers/endpoints/astronCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/astronCodingPlan.js +16 -0
- package/dist/llm/providers/endpoints/astronCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/baichuan.d.ts +10 -0
- package/dist/llm/providers/endpoints/baichuan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/baichuan.js +20 -0
- package/dist/llm/providers/endpoints/baichuan.js.map +1 -0
- package/dist/llm/providers/endpoints/bailian.d.ts +25 -0
- package/dist/llm/providers/endpoints/bailian.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/bailian.js +42 -0
- package/dist/llm/providers/endpoints/bailian.js.map +1 -0
- package/dist/llm/providers/endpoints/bailianCodingPlan.d.ts +10 -0
- package/dist/llm/providers/endpoints/bailianCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/bailianCodingPlan.js +22 -0
- package/dist/llm/providers/endpoints/bailianCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/custom.d.ts +16 -0
- package/dist/llm/providers/endpoints/custom.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/custom.js +15 -0
- package/dist/llm/providers/endpoints/custom.js.map +1 -0
- package/dist/llm/providers/endpoints/deepseek.d.ts +17 -0
- package/dist/llm/providers/endpoints/deepseek.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/deepseek.js +20 -0
- package/dist/llm/providers/endpoints/deepseek.js.map +1 -0
- package/dist/llm/providers/endpoints/giteeai.d.ts +10 -0
- package/dist/llm/providers/endpoints/giteeai.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/giteeai.js +33 -0
- package/dist/llm/providers/endpoints/giteeai.js.map +1 -0
- package/dist/llm/providers/endpoints/githubCopilot.d.ts +10 -0
- package/dist/llm/providers/endpoints/githubCopilot.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/githubCopilot.js +35 -0
- package/dist/llm/providers/endpoints/githubCopilot.js.map +1 -0
- package/dist/llm/providers/endpoints/glmCodingPlan.d.ts +9 -0
- package/dist/llm/providers/endpoints/glmCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/glmCodingPlan.js +21 -0
- package/dist/llm/providers/endpoints/glmCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/google.d.ts +12 -0
- package/dist/llm/providers/endpoints/google.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/google.js +41 -0
- package/dist/llm/providers/endpoints/google.js.map +1 -0
- package/dist/llm/providers/endpoints/hunyuan.d.ts +10 -0
- package/dist/llm/providers/endpoints/hunyuan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/hunyuan.js +34 -0
- package/dist/llm/providers/endpoints/hunyuan.js.map +1 -0
- package/dist/llm/providers/endpoints/infiniai.d.ts +10 -0
- package/dist/llm/providers/endpoints/infiniai.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/infiniai.js +64 -0
- package/dist/llm/providers/endpoints/infiniai.js.map +1 -0
- package/dist/llm/providers/endpoints/internlm.d.ts +10 -0
- package/dist/llm/providers/endpoints/internlm.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/internlm.js +20 -0
- package/dist/llm/providers/endpoints/internlm.js.map +1 -0
- package/dist/llm/providers/endpoints/kimiCode.d.ts +9 -0
- package/dist/llm/providers/endpoints/kimiCode.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/kimiCode.js +16 -0
- package/dist/llm/providers/endpoints/kimiCode.js.map +1 -0
- package/dist/llm/providers/endpoints/kimiCodingPlan.d.ts +9 -0
- package/dist/llm/providers/endpoints/kimiCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/kimiCodingPlan.js +17 -0
- package/dist/llm/providers/endpoints/kimiCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/kkaiapi.d.ts +14 -0
- package/dist/llm/providers/endpoints/kkaiapi.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/kkaiapi.js +44 -0
- package/dist/llm/providers/endpoints/kkaiapi.js.map +1 -0
- package/dist/llm/providers/endpoints/lmstudio.d.ts +10 -0
- package/dist/llm/providers/endpoints/lmstudio.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/lmstudio.js +15 -0
- package/dist/llm/providers/endpoints/lmstudio.js.map +1 -0
- package/dist/llm/providers/endpoints/longcat.d.ts +9 -0
- package/dist/llm/providers/endpoints/longcat.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/longcat.js +18 -0
- package/dist/llm/providers/endpoints/longcat.js.map +1 -0
- package/dist/llm/providers/endpoints/minimax.d.ts +15 -0
- package/dist/llm/providers/endpoints/minimax.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/minimax.js +27 -0
- package/dist/llm/providers/endpoints/minimax.js.map +1 -0
- package/dist/llm/providers/endpoints/minimaxCodingPlan.d.ts +9 -0
- package/dist/llm/providers/endpoints/minimaxCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/minimaxCodingPlan.js +21 -0
- package/dist/llm/providers/endpoints/minimaxCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/mistral.d.ts +11 -0
- package/dist/llm/providers/endpoints/mistral.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/mistral.js +31 -0
- package/dist/llm/providers/endpoints/mistral.js.map +1 -0
- package/dist/llm/providers/endpoints/modelscope.d.ts +10 -0
- package/dist/llm/providers/endpoints/modelscope.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/modelscope.js +22 -0
- package/dist/llm/providers/endpoints/modelscope.js.map +1 -0
- package/dist/llm/providers/endpoints/moonshot.d.ts +12 -0
- package/dist/llm/providers/endpoints/moonshot.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/moonshot.js +29 -0
- package/dist/llm/providers/endpoints/moonshot.js.map +1 -0
- package/dist/llm/providers/endpoints/newapi.d.ts +14 -0
- package/dist/llm/providers/endpoints/newapi.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/newapi.js +14 -0
- package/dist/llm/providers/endpoints/newapi.js.map +1 -0
- package/dist/llm/providers/endpoints/ollama.d.ts +12 -0
- package/dist/llm/providers/endpoints/ollama.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/ollama.js +63 -0
- package/dist/llm/providers/endpoints/ollama.js.map +1 -0
- package/dist/llm/providers/endpoints/openai.d.ts +12 -0
- package/dist/llm/providers/endpoints/openai.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/openai.js +67 -0
- package/dist/llm/providers/endpoints/openai.js.map +1 -0
- package/dist/llm/providers/endpoints/opencodeCodingPlan.d.ts +9 -0
- package/dist/llm/providers/endpoints/opencodeCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/opencodeCodingPlan.js +23 -0
- package/dist/llm/providers/endpoints/opencodeCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/openrouter.d.ts +15 -0
- package/dist/llm/providers/endpoints/openrouter.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/openrouter.js +75 -0
- package/dist/llm/providers/endpoints/openrouter.js.map +1 -0
- package/dist/llm/providers/endpoints/ppio.d.ts +15 -0
- package/dist/llm/providers/endpoints/ppio.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/ppio.js +73 -0
- package/dist/llm/providers/endpoints/ppio.js.map +1 -0
- package/dist/llm/providers/endpoints/qiniu.d.ts +10 -0
- package/dist/llm/providers/endpoints/qiniu.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/qiniu.js +24 -0
- package/dist/llm/providers/endpoints/qiniu.js.map +1 -0
- package/dist/llm/providers/endpoints/sensenova.d.ts +10 -0
- package/dist/llm/providers/endpoints/sensenova.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/sensenova.js +37 -0
- package/dist/llm/providers/endpoints/sensenova.js.map +1 -0
- package/dist/llm/providers/endpoints/siliconcloud.d.ts +14 -0
- package/dist/llm/providers/endpoints/siliconcloud.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/siliconcloud.js +114 -0
- package/dist/llm/providers/endpoints/siliconcloud.js.map +1 -0
- package/dist/llm/providers/endpoints/spark.d.ts +14 -0
- package/dist/llm/providers/endpoints/spark.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/spark.js +21 -0
- package/dist/llm/providers/endpoints/spark.js.map +1 -0
- package/dist/llm/providers/endpoints/stepfun.d.ts +10 -0
- package/dist/llm/providers/endpoints/stepfun.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/stepfun.js +27 -0
- package/dist/llm/providers/endpoints/stepfun.js.map +1 -0
- package/dist/llm/providers/endpoints/tencentcloud.d.ts +10 -0
- package/dist/llm/providers/endpoints/tencentcloud.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/tencentcloud.js +17 -0
- package/dist/llm/providers/endpoints/tencentcloud.js.map +1 -0
- package/dist/llm/providers/endpoints/volcengine.d.ts +10 -0
- package/dist/llm/providers/endpoints/volcengine.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/volcengine.js +44 -0
- package/dist/llm/providers/endpoints/volcengine.js.map +1 -0
- package/dist/llm/providers/endpoints/volcengineCodingPlan.d.ts +19 -0
- package/dist/llm/providers/endpoints/volcengineCodingPlan.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/volcengineCodingPlan.js +25 -0
- package/dist/llm/providers/endpoints/volcengineCodingPlan.js.map +1 -0
- package/dist/llm/providers/endpoints/wenxin.d.ts +10 -0
- package/dist/llm/providers/endpoints/wenxin.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/wenxin.js +98 -0
- package/dist/llm/providers/endpoints/wenxin.js.map +1 -0
- package/dist/llm/providers/endpoints/xai.d.ts +11 -0
- package/dist/llm/providers/endpoints/xai.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/xai.js +25 -0
- package/dist/llm/providers/endpoints/xai.js.map +1 -0
- package/dist/llm/providers/endpoints/xiaomimimo.d.ts +12 -0
- package/dist/llm/providers/endpoints/xiaomimimo.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/xiaomimimo.js +16 -0
- package/dist/llm/providers/endpoints/xiaomimimo.js.map +1 -0
- package/dist/llm/providers/endpoints/zeroone.d.ts +10 -0
- package/dist/llm/providers/endpoints/zeroone.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/zeroone.js +26 -0
- package/dist/llm/providers/endpoints/zeroone.js.map +1 -0
- package/dist/llm/providers/endpoints/zhipu.d.ts +12 -0
- package/dist/llm/providers/endpoints/zhipu.d.ts.map +1 -0
- package/dist/llm/providers/endpoints/zhipu.js +51 -0
- package/dist/llm/providers/endpoints/zhipu.js.map +1 -0
- package/dist/llm/providers/index.d.ts +5 -0
- package/dist/llm/providers/index.d.ts.map +1 -0
- package/dist/llm/providers/index.js +64 -0
- package/dist/llm/providers/index.js.map +1 -0
- package/dist/llm/providers/lookup.d.ts +16 -0
- package/dist/llm/providers/lookup.d.ts.map +1 -0
- package/dist/llm/providers/lookup.js +68 -0
- package/dist/llm/providers/lookup.js.map +1 -0
- package/dist/llm/providers/probe.d.ts +11 -0
- package/dist/llm/providers/probe.d.ts.map +1 -0
- package/dist/llm/providers/probe.js +24 -0
- package/dist/llm/providers/probe.js.map +1 -0
- package/dist/llm/providers/types.d.ts +71 -0
- package/dist/llm/providers/types.d.ts.map +1 -0
- package/dist/llm/providers/types.js +9 -0
- package/dist/llm/providers/types.js.map +1 -0
- package/dist/llm/providers/verify.d.ts +27 -0
- package/dist/llm/providers/verify.d.ts.map +1 -0
- package/dist/llm/providers/verify.js +77 -0
- package/dist/llm/providers/verify.js.map +1 -0
- package/dist/llm/secrets.d.ts +9 -0
- package/dist/llm/secrets.d.ts.map +1 -0
- package/dist/llm/secrets.js +56 -0
- package/dist/llm/secrets.js.map +1 -0
- package/dist/llm/service-presets.d.ts +45 -0
- package/dist/llm/service-presets.d.ts.map +1 -0
- package/dist/llm/service-presets.js +180 -0
- package/dist/llm/service-presets.js.map +1 -0
- package/dist/llm/service-resolver.d.ts +10 -0
- package/dist/llm/service-resolver.d.ts.map +1 -0
- package/dist/llm/service-resolver.js +62 -0
- package/dist/llm/service-resolver.js.map +1 -0
- package/dist/llm/think-tag-stripper.d.ts +15 -0
- package/dist/llm/think-tag-stripper.d.ts.map +1 -0
- package/dist/llm/think-tag-stripper.js +60 -0
- package/dist/llm/think-tag-stripper.js.map +1 -0
- package/dist/materials/ingest.d.ts +31 -0
- package/dist/materials/ingest.d.ts.map +1 -0
- package/dist/materials/ingest.js +224 -0
- package/dist/materials/ingest.js.map +1 -0
- package/dist/materials/retrieve.d.ts +20 -0
- package/dist/materials/retrieve.d.ts.map +1 -0
- package/dist/materials/retrieve.js +109 -0
- package/dist/materials/retrieve.js.map +1 -0
- package/dist/models/book-rules.d.ts +142 -0
- package/dist/models/book-rules.d.ts.map +1 -0
- package/dist/models/book-rules.js +286 -0
- package/dist/models/book-rules.js.map +1 -0
- package/dist/models/book.d.ts +94 -0
- package/dist/models/book.d.ts.map +1 -0
- package/dist/models/book.js +79 -0
- package/dist/models/book.js.map +1 -0
- package/dist/models/chapter.d.ts +131 -0
- package/dist/models/chapter.d.ts.map +1 -0
- package/dist/models/chapter.js +38 -0
- package/dist/models/chapter.js.map +1 -0
- package/dist/models/context-compression.d.ts +13 -0
- package/dist/models/context-compression.d.ts.map +1 -0
- package/dist/models/context-compression.js +2 -0
- package/dist/models/context-compression.js.map +1 -0
- package/dist/models/detection.d.ts +25 -0
- package/dist/models/detection.d.ts.map +1 -0
- package/dist/models/detection.js +2 -0
- package/dist/models/detection.js.map +1 -0
- package/dist/models/genre-profile.d.ts +45 -0
- package/dist/models/genre-profile.d.ts.map +1 -0
- package/dist/models/genre-profile.js +26 -0
- package/dist/models/genre-profile.js.map +1 -0
- package/dist/models/input-governance.d.ts +437 -0
- package/dist/models/input-governance.d.ts.map +1 -0
- package/dist/models/input-governance.js +104 -0
- package/dist/models/input-governance.js.map +1 -0
- package/dist/models/length-governance.d.ts +85 -0
- package/dist/models/length-governance.d.ts.map +1 -0
- package/dist/models/length-governance.js +31 -0
- package/dist/models/length-governance.js.map +1 -0
- package/dist/models/play.d.ts +530 -0
- package/dist/models/play.d.ts.map +1 -0
- package/dist/models/play.js +318 -0
- package/dist/models/play.js.map +1 -0
- package/dist/models/project.d.ts +797 -0
- package/dist/models/project.d.ts.map +1 -0
- package/dist/models/project.js +152 -0
- package/dist/models/project.js.map +1 -0
- package/dist/models/runtime-state.d.ts +708 -0
- package/dist/models/runtime-state.d.ts.map +1 -0
- package/dist/models/runtime-state.js +105 -0
- package/dist/models/runtime-state.js.map +1 -0
- package/dist/models/state.d.ts +48 -0
- package/dist/models/state.d.ts.map +1 -0
- package/dist/models/state.js +6 -0
- package/dist/models/state.js.map +1 -0
- package/dist/models/style-profile.d.ts +16 -0
- package/dist/models/style-profile.d.ts.map +1 -0
- package/dist/models/style-profile.js +2 -0
- package/dist/models/style-profile.js.map +1 -0
- package/dist/notify/dispatcher.d.ts +10 -0
- package/dist/notify/dispatcher.d.ts.map +1 -0
- package/dist/notify/dispatcher.js +67 -0
- package/dist/notify/dispatcher.js.map +1 -0
- package/dist/notify/feishu.d.ts +6 -0
- package/dist/notify/feishu.d.ts.map +1 -0
- package/dist/notify/feishu.js +32 -0
- package/dist/notify/feishu.js.map +1 -0
- package/dist/notify/format.d.ts +12 -0
- package/dist/notify/format.d.ts.map +1 -0
- package/dist/notify/format.js +11 -0
- package/dist/notify/format.js.map +1 -0
- package/dist/notify/telegram.d.ts +7 -0
- package/dist/notify/telegram.d.ts.map +1 -0
- package/dist/notify/telegram.js +18 -0
- package/dist/notify/telegram.js.map +1 -0
- package/dist/notify/webhook.d.ts +15 -0
- package/dist/notify/webhook.d.ts.map +1 -0
- package/dist/notify/webhook.js +28 -0
- package/dist/notify/webhook.js.map +1 -0
- package/dist/notify/wechat-work.d.ts +6 -0
- package/dist/notify/wechat-work.d.ts.map +1 -0
- package/dist/notify/wechat-work.js +15 -0
- package/dist/notify/wechat-work.js.map +1 -0
- package/dist/pipeline/chapter-persistence.d.ts +33 -0
- package/dist/pipeline/chapter-persistence.d.ts.map +1 -0
- package/dist/pipeline/chapter-persistence.js +39 -0
- package/dist/pipeline/chapter-persistence.js.map +1 -0
- package/dist/pipeline/chapter-review-cycle.d.ts +81 -0
- package/dist/pipeline/chapter-review-cycle.d.ts.map +1 -0
- package/dist/pipeline/chapter-review-cycle.js +190 -0
- package/dist/pipeline/chapter-review-cycle.js.map +1 -0
- package/dist/pipeline/chapter-state-recovery.d.ts +61 -0
- package/dist/pipeline/chapter-state-recovery.d.ts.map +1 -0
- package/dist/pipeline/chapter-state-recovery.js +135 -0
- package/dist/pipeline/chapter-state-recovery.js.map +1 -0
- package/dist/pipeline/chapter-truth-validation.d.ts +42 -0
- package/dist/pipeline/chapter-truth-validation.d.ts.map +1 -0
- package/dist/pipeline/chapter-truth-validation.js +93 -0
- package/dist/pipeline/chapter-truth-validation.js.map +1 -0
- package/dist/pipeline/detection-runner.d.ts +31 -0
- package/dist/pipeline/detection-runner.d.ts.map +1 -0
- package/dist/pipeline/detection-runner.js +109 -0
- package/dist/pipeline/detection-runner.js.map +1 -0
- package/dist/pipeline/persisted-governed-plan.d.ts +5 -0
- package/dist/pipeline/persisted-governed-plan.d.ts.map +1 -0
- package/dist/pipeline/persisted-governed-plan.js +249 -0
- package/dist/pipeline/persisted-governed-plan.js.map +1 -0
- package/dist/pipeline/runner.d.ts +334 -0
- package/dist/pipeline/runner.d.ts.map +1 -0
- package/dist/pipeline/runner.js +2974 -0
- package/dist/pipeline/runner.js.map +1 -0
- package/dist/pipeline/scheduler.d.ts +58 -0
- package/dist/pipeline/scheduler.d.ts.map +1 -0
- package/dist/pipeline/scheduler.js +322 -0
- package/dist/pipeline/scheduler.js.map +1 -0
- package/dist/pipeline/script-storyboard-runner.d.ts +130 -0
- package/dist/pipeline/script-storyboard-runner.d.ts.map +1 -0
- package/dist/pipeline/script-storyboard-runner.js +532 -0
- package/dist/pipeline/script-storyboard-runner.js.map +1 -0
- package/dist/pipeline/short-fiction-runner.d.ts +110 -0
- package/dist/pipeline/short-fiction-runner.d.ts.map +1 -0
- package/dist/pipeline/short-fiction-runner.js +864 -0
- package/dist/pipeline/short-fiction-runner.js.map +1 -0
- package/dist/play/play-agents.d.ts +72 -0
- package/dist/play/play-agents.d.ts.map +1 -0
- package/dist/play/play-agents.js +580 -0
- package/dist/play/play-agents.js.map +1 -0
- package/dist/play/play-db-factory.d.ts +9 -0
- package/dist/play/play-db-factory.d.ts.map +1 -0
- package/dist/play/play-db-factory.js +18 -0
- package/dist/play/play-db-factory.js.map +1 -0
- package/dist/play/play-db.d.ts +22 -0
- package/dist/play/play-db.d.ts.map +1 -0
- package/dist/play/play-db.js +248 -0
- package/dist/play/play-db.js.map +1 -0
- package/dist/play/play-file-db.d.ts +32 -0
- package/dist/play/play-file-db.d.ts.map +1 -0
- package/dist/play/play-file-db.js +156 -0
- package/dist/play/play-file-db.js.map +1 -0
- package/dist/play/play-image.d.ts +58 -0
- package/dist/play/play-image.d.ts.map +1 -0
- package/dist/play/play-image.js +142 -0
- package/dist/play/play-image.js.map +1 -0
- package/dist/play/play-reducer.d.ts +31 -0
- package/dist/play/play-reducer.d.ts.map +1 -0
- package/dist/play/play-reducer.js +261 -0
- package/dist/play/play-reducer.js.map +1 -0
- package/dist/play/play-runner.d.ts +116 -0
- package/dist/play/play-runner.d.ts.map +1 -0
- package/dist/play/play-runner.js +582 -0
- package/dist/play/play-runner.js.map +1 -0
- package/dist/play/play-store.d.ts +113 -0
- package/dist/play/play-store.d.ts.map +1 -0
- package/dist/play/play-store.js +314 -0
- package/dist/play/play-store.js.map +1 -0
- package/dist/production/harness.d.ts +57 -0
- package/dist/production/harness.d.ts.map +1 -0
- package/dist/production/harness.js +51 -0
- package/dist/production/harness.js.map +1 -0
- package/dist/prompts/builtin-prompts.d.ts +10 -0
- package/dist/prompts/builtin-prompts.d.ts.map +1 -0
- package/dist/prompts/builtin-prompts.js +157 -0
- package/dist/prompts/builtin-prompts.js.map +1 -0
- package/dist/prompts/index.d.ts +5 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +5 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/prompt-pack.d.ts +33 -0
- package/dist/prompts/prompt-pack.d.ts.map +1 -0
- package/dist/prompts/prompt-pack.js +82 -0
- package/dist/prompts/prompt-pack.js.map +1 -0
- package/dist/prompts/short-fiction.d.ts +58 -0
- package/dist/prompts/short-fiction.d.ts.map +1 -0
- package/dist/prompts/short-fiction.js +480 -0
- package/dist/prompts/short-fiction.js.map +1 -0
- package/dist/prompts/types.d.ts +22 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +9 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/references/book-references.d.ts +40 -0
- package/dist/references/book-references.d.ts.map +1 -0
- package/dist/references/book-references.js +207 -0
- package/dist/references/book-references.js.map +1 -0
- package/dist/references/reference-context.d.ts +26 -0
- package/dist/references/reference-context.d.ts.map +1 -0
- package/dist/references/reference-context.js +120 -0
- package/dist/references/reference-context.js.map +1 -0
- package/dist/retrieval/local-search.d.ts +38 -0
- package/dist/retrieval/local-search.d.ts.map +1 -0
- package/dist/retrieval/local-search.js +232 -0
- package/dist/retrieval/local-search.js.map +1 -0
- package/dist/skills/builtin-loader.d.ts +9 -0
- package/dist/skills/builtin-loader.d.ts.map +1 -0
- package/dist/skills/builtin-loader.js +24 -0
- package/dist/skills/builtin-loader.js.map +1 -0
- package/dist/skills/external-loader.d.ts +26 -0
- package/dist/skills/external-loader.d.ts.map +1 -0
- package/dist/skills/external-loader.js +186 -0
- package/dist/skills/external-loader.js.map +1 -0
- package/dist/skills/index.d.ts +6 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +6 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/production-bindings.d.ts +18 -0
- package/dist/skills/production-bindings.d.ts.map +1 -0
- package/dist/skills/production-bindings.js +37 -0
- package/dist/skills/production-bindings.js.map +1 -0
- package/dist/skills/registry.d.ts +6 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +68 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +42 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +10 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/state/chapter-delete.d.ts +30 -0
- package/dist/state/chapter-delete.d.ts.map +1 -0
- package/dist/state/chapter-delete.js +78 -0
- package/dist/state/chapter-delete.js.map +1 -0
- package/dist/state/chapter-word-sync.d.ts +30 -0
- package/dist/state/chapter-word-sync.d.ts.map +1 -0
- package/dist/state/chapter-word-sync.js +62 -0
- package/dist/state/chapter-word-sync.js.map +1 -0
- package/dist/state/chapter-workspace.d.ts +15 -0
- package/dist/state/chapter-workspace.d.ts.map +1 -0
- package/dist/state/chapter-workspace.js +118 -0
- package/dist/state/chapter-workspace.js.map +1 -0
- package/dist/state/manager.d.ts +70 -0
- package/dist/state/manager.d.ts.map +1 -0
- package/dist/state/manager.js +727 -0
- package/dist/state/manager.js.map +1 -0
- package/dist/state/memory-db.d.ts +83 -0
- package/dist/state/memory-db.d.ts.map +1 -0
- package/dist/state/memory-db.js +249 -0
- package/dist/state/memory-db.js.map +1 -0
- package/dist/state/runtime-state-store.d.ts +38 -0
- package/dist/state/runtime-state-store.d.ts.map +1 -0
- package/dist/state/runtime-state-store.js +164 -0
- package/dist/state/runtime-state-store.js.map +1 -0
- package/dist/state/state-bootstrap.d.ts +21 -0
- package/dist/state/state-bootstrap.d.ts.map +1 -0
- package/dist/state/state-bootstrap.js +476 -0
- package/dist/state/state-bootstrap.js.map +1 -0
- package/dist/state/state-projections.d.ts +7 -0
- package/dist/state/state-projections.d.ts.map +1 -0
- package/dist/state/state-projections.js +209 -0
- package/dist/state/state-projections.js.map +1 -0
- package/dist/state/state-reducer.d.ts +13 -0
- package/dist/state/state-reducer.d.ts.map +1 -0
- package/dist/state/state-reducer.js +193 -0
- package/dist/state/state-reducer.js.map +1 -0
- package/dist/state/state-validator.d.ts +12 -0
- package/dist/state/state-validator.d.ts.map +1 -0
- package/dist/state/state-validator.js +67 -0
- package/dist/state/state-validator.js.map +1 -0
- package/dist/translation/epub.d.ts +10 -0
- package/dist/translation/epub.d.ts.map +1 -0
- package/dist/translation/epub.js +86 -0
- package/dist/translation/epub.js.map +1 -0
- package/dist/translation/export.d.ts +6 -0
- package/dist/translation/export.d.ts.map +1 -0
- package/dist/translation/export.js +68 -0
- package/dist/translation/export.js.map +1 -0
- package/dist/translation/index.d.ts +9 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +9 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/llm-model.d.ts +11 -0
- package/dist/translation/llm-model.d.ts.map +1 -0
- package/dist/translation/llm-model.js +135 -0
- package/dist/translation/llm-model.js.map +1 -0
- package/dist/translation/project.d.ts +3 -0
- package/dist/translation/project.d.ts.map +1 -0
- package/dist/translation/project.js +76 -0
- package/dist/translation/project.js.map +1 -0
- package/dist/translation/run-store.d.ts +12 -0
- package/dist/translation/run-store.d.ts.map +1 -0
- package/dist/translation/run-store.js +69 -0
- package/dist/translation/run-store.js.map +1 -0
- package/dist/translation/runner.d.ts +6 -0
- package/dist/translation/runner.d.ts.map +1 -0
- package/dist/translation/runner.js +155 -0
- package/dist/translation/runner.js.map +1 -0
- package/dist/translation/source.d.ts +12 -0
- package/dist/translation/source.d.ts.map +1 -0
- package/dist/translation/source.js +66 -0
- package/dist/translation/source.js.map +1 -0
- package/dist/translation/text.d.ts +10 -0
- package/dist/translation/text.d.ts.map +1 -0
- package/dist/translation/text.js +110 -0
- package/dist/translation/text.js.map +1 -0
- package/dist/translation/types.d.ts +96 -0
- package/dist/translation/types.d.ts.map +1 -0
- package/dist/translation/types.js +2 -0
- package/dist/translation/types.js.map +1 -0
- package/dist/utils/analytics.d.ts +39 -0
- package/dist/utils/analytics.d.ts.map +1 -0
- package/dist/utils/analytics.js +50 -0
- package/dist/utils/analytics.js.map +1 -0
- package/dist/utils/atomic-file-set.d.ts +12 -0
- package/dist/utils/atomic-file-set.d.ts.map +1 -0
- package/dist/utils/atomic-file-set.js +93 -0
- package/dist/utils/atomic-file-set.js.map +1 -0
- package/dist/utils/book-eval.d.ts +35 -0
- package/dist/utils/book-eval.d.ts.map +1 -0
- package/dist/utils/book-eval.js +116 -0
- package/dist/utils/book-eval.js.map +1 -0
- package/dist/utils/book-id.d.ts +4 -0
- package/dist/utils/book-id.d.ts.map +1 -0
- package/dist/utils/book-id.js +27 -0
- package/dist/utils/book-id.js.map +1 -0
- package/dist/utils/cadence-policy.d.ts +36 -0
- package/dist/utils/cadence-policy.d.ts.map +1 -0
- package/dist/utils/cadence-policy.js +38 -0
- package/dist/utils/cadence-policy.js.map +1 -0
- package/dist/utils/chapter-cadence.d.ts +34 -0
- package/dist/utils/chapter-cadence.d.ts.map +1 -0
- package/dist/utils/chapter-cadence.js +143 -0
- package/dist/utils/chapter-cadence.js.map +1 -0
- package/dist/utils/chapter-memo-parser.d.ts +22 -0
- package/dist/utils/chapter-memo-parser.d.ts.map +1 -0
- package/dist/utils/chapter-memo-parser.js +158 -0
- package/dist/utils/chapter-memo-parser.js.map +1 -0
- package/dist/utils/chapter-splitter.d.ts +18 -0
- package/dist/utils/chapter-splitter.d.ts.map +1 -0
- package/dist/utils/chapter-splitter.js +60 -0
- package/dist/utils/chapter-splitter.js.map +1 -0
- package/dist/utils/config-loader.d.ts +11 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +16 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/context-assembly.d.ts +29 -0
- package/dist/utils/context-assembly.d.ts.map +1 -0
- package/dist/utils/context-assembly.js +117 -0
- package/dist/utils/context-assembly.js.map +1 -0
- package/dist/utils/context-filter.d.ts +31 -0
- package/dist/utils/context-filter.d.ts.map +1 -0
- package/dist/utils/context-filter.js +163 -0
- package/dist/utils/context-filter.js.map +1 -0
- package/dist/utils/effective-llm-config.d.ts +34 -0
- package/dist/utils/effective-llm-config.d.ts.map +1 -0
- package/dist/utils/effective-llm-config.js +463 -0
- package/dist/utils/effective-llm-config.js.map +1 -0
- package/dist/utils/governed-context.d.ts +11 -0
- package/dist/utils/governed-context.d.ts.map +1 -0
- package/dist/utils/governed-context.js +42 -0
- package/dist/utils/governed-context.js.map +1 -0
- package/dist/utils/governed-working-set.d.ts +18 -0
- package/dist/utils/governed-working-set.d.ts.map +1 -0
- package/dist/utils/governed-working-set.js +296 -0
- package/dist/utils/governed-working-set.js.map +1 -0
- package/dist/utils/hook-arbiter.d.ts +16 -0
- package/dist/utils/hook-arbiter.d.ts.map +1 -0
- package/dist/utils/hook-arbiter.js +161 -0
- package/dist/utils/hook-arbiter.js.map +1 -0
- package/dist/utils/hook-governance.d.ts +26 -0
- package/dist/utils/hook-governance.d.ts.map +1 -0
- package/dist/utils/hook-governance.js +65 -0
- package/dist/utils/hook-governance.js.map +1 -0
- package/dist/utils/hook-health.d.ts +15 -0
- package/dist/utils/hook-health.d.ts.map +1 -0
- package/dist/utils/hook-health.js +131 -0
- package/dist/utils/hook-health.js.map +1 -0
- package/dist/utils/hook-ledger-validator.d.ts +82 -0
- package/dist/utils/hook-ledger-validator.d.ts.map +1 -0
- package/dist/utils/hook-ledger-validator.js +225 -0
- package/dist/utils/hook-ledger-validator.js.map +1 -0
- package/dist/utils/hook-lifecycle.d.ts +41 -0
- package/dist/utils/hook-lifecycle.d.ts.map +1 -0
- package/dist/utils/hook-lifecycle.js +183 -0
- package/dist/utils/hook-lifecycle.js.map +1 -0
- package/dist/utils/hook-policy.d.ts +57 -0
- package/dist/utils/hook-policy.d.ts.map +1 -0
- package/dist/utils/hook-policy.js +96 -0
- package/dist/utils/hook-policy.js.map +1 -0
- package/dist/utils/hook-promotion.d.ts +83 -0
- package/dist/utils/hook-promotion.d.ts.map +1 -0
- package/dist/utils/hook-promotion.js +241 -0
- package/dist/utils/hook-promotion.js.map +1 -0
- package/dist/utils/hook-stale-detection.d.ts +51 -0
- package/dist/utils/hook-stale-detection.d.ts.map +1 -0
- package/dist/utils/hook-stale-detection.js +125 -0
- package/dist/utils/hook-stale-detection.js.map +1 -0
- package/dist/utils/language.d.ts +19 -0
- package/dist/utils/language.d.ts.map +1 -0
- package/dist/utils/language.js +29 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/length-metrics.d.ts +12 -0
- package/dist/utils/length-metrics.d.ts.map +1 -0
- package/dist/utils/length-metrics.js +85 -0
- package/dist/utils/length-metrics.js.map +1 -0
- package/dist/utils/llm-endpoint-auth.d.ts +5 -0
- package/dist/utils/llm-endpoint-auth.d.ts.map +1 -0
- package/dist/utils/llm-endpoint-auth.js +36 -0
- package/dist/utils/llm-endpoint-auth.js.map +1 -0
- package/dist/utils/llm-env.d.ts +14 -0
- package/dist/utils/llm-env.d.ts.map +1 -0
- package/dist/utils/llm-env.js +53 -0
- package/dist/utils/llm-env.js.map +1 -0
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +79 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/long-span-fatigue.d.ts +28 -0
- package/dist/utils/long-span-fatigue.d.ts.map +1 -0
- package/dist/utils/long-span-fatigue.js +406 -0
- package/dist/utils/long-span-fatigue.js.map +1 -0
- package/dist/utils/memory-retrieval.d.ts +71 -0
- package/dist/utils/memory-retrieval.d.ts.map +1 -0
- package/dist/utils/memory-retrieval.js +360 -0
- package/dist/utils/memory-retrieval.js.map +1 -0
- package/dist/utils/narrative-control.d.ts +16 -0
- package/dist/utils/narrative-control.d.ts.map +1 -0
- package/dist/utils/narrative-control.js +131 -0
- package/dist/utils/narrative-control.js.map +1 -0
- package/dist/utils/outline-paths.d.ts +63 -0
- package/dist/utils/outline-paths.d.ts.map +1 -0
- package/dist/utils/outline-paths.js +311 -0
- package/dist/utils/outline-paths.js.map +1 -0
- package/dist/utils/path-safety.d.ts +2 -0
- package/dist/utils/path-safety.d.ts.map +1 -0
- package/dist/utils/path-safety.js +11 -0
- package/dist/utils/path-safety.js.map +1 -0
- package/dist/utils/planning-materials.d.ts +35 -0
- package/dist/utils/planning-materials.d.ts.map +1 -0
- package/dist/utils/planning-materials.js +123 -0
- package/dist/utils/planning-materials.js.map +1 -0
- package/dist/utils/posix-path.d.ts +2 -0
- package/dist/utils/posix-path.d.ts.map +1 -0
- package/dist/utils/posix-path.js +7 -0
- package/dist/utils/posix-path.js.map +1 -0
- package/dist/utils/pov-filter.d.ts +30 -0
- package/dist/utils/pov-filter.d.ts.map +1 -0
- package/dist/utils/pov-filter.js +129 -0
- package/dist/utils/pov-filter.js.map +1 -0
- package/dist/utils/proxy-fetch.d.ts +9 -0
- package/dist/utils/proxy-fetch.d.ts.map +1 -0
- package/dist/utils/proxy-fetch.js +31 -0
- package/dist/utils/proxy-fetch.js.map +1 -0
- package/dist/utils/runtime-writer.d.ts +14 -0
- package/dist/utils/runtime-writer.d.ts.map +1 -0
- package/dist/utils/runtime-writer.js +21 -0
- package/dist/utils/runtime-writer.js.map +1 -0
- package/dist/utils/spot-fix-patches.d.ts +21 -0
- package/dist/utils/spot-fix-patches.d.ts.map +1 -0
- package/dist/utils/spot-fix-patches.js +148 -0
- package/dist/utils/spot-fix-patches.js.map +1 -0
- package/dist/utils/story-markdown.d.ts +13 -0
- package/dist/utils/story-markdown.d.ts.map +1 -0
- package/dist/utils/story-markdown.js +320 -0
- package/dist/utils/story-markdown.js.map +1 -0
- package/dist/utils/web-search.d.ts +28 -0
- package/dist/utils/web-search.d.ts.map +1 -0
- package/dist/utils/web-search.js +72 -0
- package/dist/utils/web-search.js.map +1 -0
- package/dist/utils/writing-methodology.d.ts +10 -0
- package/dist/utils/writing-methodology.d.ts.map +1 -0
- package/dist/utils/writing-methodology.js +163 -0
- package/dist/utils/writing-methodology.js.map +1 -0
- package/genres/cozy.md +43 -0
- package/genres/cultivation.md +42 -0
- package/genres/dungeon-core.md +40 -0
- package/genres/horror.md +51 -0
- package/genres/isekai.md +43 -0
- package/genres/litrpg.md +43 -0
- package/genres/other.md +24 -0
- package/genres/progression.md +41 -0
- package/genres/romantasy.md +45 -0
- package/genres/sci-fi.md +42 -0
- package/genres/system-apocalypse.md +40 -0
- package/genres/tower-climber.md +41 -0
- package/genres/urban.md +53 -0
- package/genres/xianxia.md +46 -0
- package/genres/xuanhuan.md +64 -0
- package/package.json +76 -0
- package/skills/inkos-interactive-film/SKILL.md +16 -0
- package/skills/inkos-interactive-film/references/branch-state-craft.md +13 -0
- package/skills/inkos-long-market-research/SKILL.md +16 -0
- package/skills/inkos-long-market-research/references/research-rubric.md +19 -0
- package/skills/inkos-long-story-analysis/SKILL.md +17 -0
- package/skills/inkos-long-story-analysis/references/analysis-lens.md +16 -0
- package/skills/inkos-long-writing/SKILL.md +17 -0
- package/skills/inkos-long-writing/references/reader-contract-and-progression.md +13 -0
- package/skills/inkos-long-writing/references/scene-dialogue-and-length-budget.md +13 -0
- package/skills/inkos-play-world/SKILL.md +17 -0
- package/skills/inkos-play-world/references/world-turn-continuity.md +13 -0
- package/skills/inkos-script-writing/SKILL.md +15 -0
- package/skills/inkos-script-writing/references/episode-scene-craft.md +13 -0
- package/skills/inkos-short-market-research/SKILL.md +17 -0
- package/skills/inkos-short-market-research/references/short-market-rubric.md +16 -0
- package/skills/inkos-short-story-analysis/SKILL.md +16 -0
- package/skills/inkos-short-story-analysis/references/deconstruction-template.md +14 -0
- package/skills/inkos-short-writing/SKILL.md +18 -0
- package/skills/inkos-short-writing/references/production-checklist.md +19 -0
- package/skills/inkos-story-cover/SKILL.md +17 -0
- package/skills/inkos-story-cover/references/cover-brief.md +16 -0
- package/skills/inkos-story-deslop/SKILL.md +16 -0
- package/skills/inkos-story-deslop/references/semantic-cleanup.md +13 -0
- package/skills/inkos-story-import/SKILL.md +19 -0
- package/skills/inkos-story-import/references/reconstruction-rubric.md +13 -0
- package/skills/inkos-story-review/SKILL.md +16 -0
- package/skills/inkos-story-review/references/review-matrix.md +21 -0
- package/skills/inkos-storyboard/SKILL.md +15 -0
- package/skills/inkos-storyboard/references/shot-continuity.md +13 -0
- package/skills/inkos-translation/SKILL.md +14 -0
- package/skills/inkos-translation/references/long-form-consistency.md +13 -0
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { SHORT_FICTION_DEFAULT_CHAPTERS, SHORT_FICTION_DEFAULT_CHARS_PER_CHAPTER, SHORT_FICTION_EN_DEFAULT_WORDS_PER_CHAPTER, SHORT_FICTION_EN_MAX_WORDS_PER_CHAPTER, SHORT_FICTION_EN_MIN_WORDS_PER_CHAPTER, SHORT_FICTION_MAX_CHAPTERS, SHORT_FICTION_MAX_CHARS_PER_CHAPTER, SHORT_FICTION_MIN_CHAPTERS, SHORT_FICTION_MIN_CHARS_PER_CHAPTER, ShortFictionDraftReviewerAgent, ShortFictionDraftReviserAgent, ShortFictionOutlineAgent, ShortFictionOutlineReviewerAgent, ShortFictionOutlineReviserAgent, ShortFictionPackagingAgent, ShortFictionWriterAgent, findEmptyShortFictionChapters, formatShortFictionChapterHeading, renderShortFictionDraftMarkdown, validateShortFictionDraftForFinal, } from "../agents/short-fiction.js";
|
|
5
|
+
import { coverSecretKey, normalizeCoverBaseUrl, resolveCoverProviderPreset, } from "../llm/cover-providers.js";
|
|
6
|
+
import { loadSecrets } from "../llm/secrets.js";
|
|
7
|
+
import { createProductionRunSnapshot, createRangeObservation, writeProductionRunSnapshot, } from "../production/harness.js";
|
|
8
|
+
import { buildLengthSpec, countChapterLength } from "../utils/length-metrics.js";
|
|
9
|
+
import { safeChildPath } from "../utils/path-safety.js";
|
|
10
|
+
import { toPosixPath as projectPath } from "../utils/posix-path.js";
|
|
11
|
+
import { commitAtomicFileSet } from "../utils/atomic-file-set.js";
|
|
12
|
+
const SHORT_FICTION_DRAFT_COMPLETION_ATTEMPTS = 3;
|
|
13
|
+
export async function runShortFictionProduction(options) {
|
|
14
|
+
const root = options.projectRoot;
|
|
15
|
+
const outDir = normalizeOutputDir(options.outDir ?? "shorts");
|
|
16
|
+
const providedStoryId = options.storyId
|
|
17
|
+
? safeSegment(options.storyId)
|
|
18
|
+
: options.title?.trim()
|
|
19
|
+
? safeSegment(slugify(options.title))
|
|
20
|
+
: undefined;
|
|
21
|
+
// A stable storyId lets a re-run resume from disk instead of redoing finished
|
|
22
|
+
// work — a transient failure in a late stage used to throw the whole short
|
|
23
|
+
// away (orphaning outline/drafts). If it already finished, return it as-is.
|
|
24
|
+
if (providedStoryId
|
|
25
|
+
&& await projectFileExists(root, join(outDir, providedStoryId, "final", "full.md"))
|
|
26
|
+
&& !await isFailedShortRun(root, join(outDir, providedStoryId, "status.json"))) {
|
|
27
|
+
return buildShortRunResult(providedStoryId, join(outDir, providedStoryId), { coverError: "already-complete" });
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return await produceShort(options, root, outDir, providedStoryId);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
// Mark the partial output as failed so drafts can't masquerade as a short.
|
|
34
|
+
if (providedStoryId) {
|
|
35
|
+
await writeShortRunSnapshot(root, join(outDir, providedStoryId), {
|
|
36
|
+
storyId: providedStoryId,
|
|
37
|
+
status: "failed",
|
|
38
|
+
stage: "production",
|
|
39
|
+
artifacts: [],
|
|
40
|
+
observations: [],
|
|
41
|
+
error: error instanceof Error ? error.message : String(error),
|
|
42
|
+
}).catch(() => undefined);
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function produceShort(options, root, outDir, providedStoryId) {
|
|
48
|
+
const language = options.language ?? "zh";
|
|
49
|
+
const chapterCount = boundedInteger(options.chapterCount, SHORT_FICTION_DEFAULT_CHAPTERS, "chapterCount", SHORT_FICTION_MIN_CHAPTERS, SHORT_FICTION_MAX_CHAPTERS);
|
|
50
|
+
// charsPerChapter is the language's native unit: zh chars (900-1200) or en words (600-800).
|
|
51
|
+
const charsPerChapter = language === "en"
|
|
52
|
+
? boundedInteger(options.charsPerChapter, SHORT_FICTION_EN_DEFAULT_WORDS_PER_CHAPTER, "charsPerChapter", SHORT_FICTION_EN_MIN_WORDS_PER_CHAPTER, SHORT_FICTION_EN_MAX_WORDS_PER_CHAPTER)
|
|
53
|
+
: boundedInteger(options.charsPerChapter, SHORT_FICTION_DEFAULT_CHARS_PER_CHAPTER, "charsPerChapter", SHORT_FICTION_MIN_CHARS_PER_CHAPTER, SHORT_FICTION_MAX_CHARS_PER_CHAPTER);
|
|
54
|
+
// Resume the (3-stage) outline from disk if v002 already exists for this id —
|
|
55
|
+
// the writer + everything downstream only need the outline markdown.
|
|
56
|
+
const resumedOutline = providedStoryId
|
|
57
|
+
? await tryReadProjectText(root, join(outDir, providedStoryId, "outline", "v002.md"))
|
|
58
|
+
: undefined;
|
|
59
|
+
let outlineMarkdown;
|
|
60
|
+
let outlineRevisionWarning;
|
|
61
|
+
let storyId;
|
|
62
|
+
let baseDir;
|
|
63
|
+
if (providedStoryId && resumedOutline?.trim()) {
|
|
64
|
+
storyId = providedStoryId;
|
|
65
|
+
baseDir = join(outDir, storyId);
|
|
66
|
+
outlineMarkdown = resumedOutline;
|
|
67
|
+
options.onProgress?.("Resuming from existing outline (skipping outline stages)...");
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
options.onProgress?.("Creating short fiction outline...");
|
|
71
|
+
const outlineAgent = new ShortFictionOutlineAgent(options.runtimes.planner);
|
|
72
|
+
const outlineV1 = await outlineAgent.createOutline({
|
|
73
|
+
direction: options.direction,
|
|
74
|
+
chapterCount,
|
|
75
|
+
charsPerChapter,
|
|
76
|
+
reference: options.reference,
|
|
77
|
+
language,
|
|
78
|
+
});
|
|
79
|
+
storyId = providedStoryId ?? safeSegment(slugify(outlineV1.storyTitle || options.direction));
|
|
80
|
+
baseDir = join(outDir, storyId);
|
|
81
|
+
await writeText(root, join(baseDir, "outline", "v001.md"), outlineV1.rawContent);
|
|
82
|
+
options.onProgress?.("Reviewing outline...");
|
|
83
|
+
const outlineReviewer = new ShortFictionOutlineReviewerAgent(options.runtimes.outlineReview);
|
|
84
|
+
const outlineReview = await outlineReviewer.reviewOutline({
|
|
85
|
+
direction: options.direction,
|
|
86
|
+
outline: outlineV1,
|
|
87
|
+
reference: options.reference,
|
|
88
|
+
language,
|
|
89
|
+
});
|
|
90
|
+
await writeText(root, join(baseDir, "reviews", "outline-v001.md"), outlineReview);
|
|
91
|
+
options.onProgress?.("Revising outline once...");
|
|
92
|
+
const outlineReviser = new ShortFictionOutlineReviserAgent(options.runtimes.planner);
|
|
93
|
+
try {
|
|
94
|
+
const outlineV2 = await outlineReviser.reviseOutline({
|
|
95
|
+
direction: options.direction,
|
|
96
|
+
outline: outlineV1,
|
|
97
|
+
review: outlineReview,
|
|
98
|
+
reference: options.reference,
|
|
99
|
+
chapterCount,
|
|
100
|
+
charsPerChapter,
|
|
101
|
+
language,
|
|
102
|
+
});
|
|
103
|
+
await writeText(root, join(baseDir, "outline", "v002.md"), outlineV2.rawContent);
|
|
104
|
+
outlineMarkdown = outlineV2.rawContent;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
outlineRevisionWarning = error instanceof Error ? error.message : String(error);
|
|
108
|
+
outlineMarkdown = outlineV1.rawContent;
|
|
109
|
+
await writeText(root, join(baseDir, "outline", "v002.md"), outlineMarkdown);
|
|
110
|
+
await writeText(root, join(baseDir, "reviews", "outline-v002-warning.md"), language === "en"
|
|
111
|
+
? [
|
|
112
|
+
"# Outline revision not adopted",
|
|
113
|
+
"",
|
|
114
|
+
"The complete first outline remains authoritative because the optional revision did not finish cleanly.",
|
|
115
|
+
"",
|
|
116
|
+
"## Reason",
|
|
117
|
+
"",
|
|
118
|
+
outlineRevisionWarning,
|
|
119
|
+
].join("\n")
|
|
120
|
+
: [
|
|
121
|
+
"# 第二版大纲未采用",
|
|
122
|
+
"",
|
|
123
|
+
"可用的第一版大纲继续生效;可选修订没有完整结束,系统没有用残缺输出覆盖它。",
|
|
124
|
+
"",
|
|
125
|
+
"## 原因",
|
|
126
|
+
"",
|
|
127
|
+
outlineRevisionWarning,
|
|
128
|
+
].join("\n"));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
let finalDraft;
|
|
132
|
+
let revisionWarning;
|
|
133
|
+
let salesPackage;
|
|
134
|
+
try {
|
|
135
|
+
options.onProgress?.("Writing full short fiction draft...");
|
|
136
|
+
const writer = new ShortFictionWriterAgent(options.runtimes.writer);
|
|
137
|
+
let draftV1 = await writer.writeDraft({
|
|
138
|
+
direction: options.direction,
|
|
139
|
+
outlineMarkdown,
|
|
140
|
+
chapterCount,
|
|
141
|
+
charsPerChapter,
|
|
142
|
+
language,
|
|
143
|
+
});
|
|
144
|
+
let missingFromDraft = findEmptyShortFictionChapters(draftV1);
|
|
145
|
+
if (missingFromDraft.length > 0) {
|
|
146
|
+
await writeDraftArtifacts(root, baseDir, "v001-partial", draftV1, language);
|
|
147
|
+
for (let attempt = 1; missingFromDraft.length > 0 && attempt <= SHORT_FICTION_DRAFT_COMPLETION_ATTEMPTS; attempt += 1) {
|
|
148
|
+
options.onProgress?.(`Completing missing short fiction chapters: ${missingFromDraft.join(", ")}...`);
|
|
149
|
+
draftV1 = await writer.continueDraft({
|
|
150
|
+
direction: options.direction,
|
|
151
|
+
outlineMarkdown,
|
|
152
|
+
chapterCount,
|
|
153
|
+
charsPerChapter,
|
|
154
|
+
language,
|
|
155
|
+
draft: draftV1,
|
|
156
|
+
});
|
|
157
|
+
missingFromDraft = findEmptyShortFictionChapters(draftV1);
|
|
158
|
+
if (missingFromDraft.length > 0) {
|
|
159
|
+
await writeDraftArtifacts(root, baseDir, "v001-partial", draftV1, language);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
validateShortFictionDraftForFinal(draftV1, { expectedChapters: chapterCount });
|
|
164
|
+
await writeDraftArtifacts(root, baseDir, "v001", draftV1, language);
|
|
165
|
+
options.onProgress?.("Reviewing full draft...");
|
|
166
|
+
const draftReviewer = new ShortFictionDraftReviewerAgent(options.runtimes.draftReview);
|
|
167
|
+
const draftReview = await draftReviewer.reviewDraft({
|
|
168
|
+
direction: options.direction,
|
|
169
|
+
outlineMarkdown,
|
|
170
|
+
draft: draftV1,
|
|
171
|
+
chapterCount,
|
|
172
|
+
charsPerChapter,
|
|
173
|
+
language,
|
|
174
|
+
});
|
|
175
|
+
await writeText(root, join(baseDir, "reviews", "draft-v001.md"), draftReview);
|
|
176
|
+
finalDraft = draftV1;
|
|
177
|
+
options.onProgress?.("Revising full draft once...");
|
|
178
|
+
const reviser = new ShortFictionDraftReviserAgent(options.runtimes.revise);
|
|
179
|
+
try {
|
|
180
|
+
const draftV2 = await reviser.reviseDraft({
|
|
181
|
+
direction: options.direction,
|
|
182
|
+
outlineMarkdown,
|
|
183
|
+
draft: draftV1,
|
|
184
|
+
review: draftReview,
|
|
185
|
+
chapterCount,
|
|
186
|
+
charsPerChapter,
|
|
187
|
+
language,
|
|
188
|
+
});
|
|
189
|
+
validateShortFictionDraftForFinal(draftV2, { expectedChapters: chapterCount });
|
|
190
|
+
await writeDraftArtifacts(root, baseDir, "v002", draftV2, language);
|
|
191
|
+
finalDraft = draftV2;
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
revisionWarning = error instanceof Error ? error.message : String(error);
|
|
195
|
+
await writeText(root, join(baseDir, "reviews", "draft-v002-warning.md"), language === "en"
|
|
196
|
+
? [
|
|
197
|
+
"# Second revision not adopted",
|
|
198
|
+
"",
|
|
199
|
+
"The system refused to overwrite the complete first draft with an incomplete or unparsable revision.",
|
|
200
|
+
"",
|
|
201
|
+
"## Reason",
|
|
202
|
+
"",
|
|
203
|
+
revisionWarning,
|
|
204
|
+
].join("\n")
|
|
205
|
+
: [
|
|
206
|
+
"# 第二轮改稿未采用",
|
|
207
|
+
"",
|
|
208
|
+
"系统没有用不完整或解析失败的改稿覆盖完整首稿。",
|
|
209
|
+
"",
|
|
210
|
+
"## 原因",
|
|
211
|
+
"",
|
|
212
|
+
revisionWarning,
|
|
213
|
+
].join("\n"));
|
|
214
|
+
}
|
|
215
|
+
await writeFinalArtifacts(root, baseDir, finalDraft, language);
|
|
216
|
+
options.onProgress?.("Generating synopsis and cover prompt...");
|
|
217
|
+
const packager = new ShortFictionPackagingAgent(options.runtimes.package);
|
|
218
|
+
salesPackage = await packager.generatePackage({
|
|
219
|
+
direction: options.direction,
|
|
220
|
+
outlineMarkdown,
|
|
221
|
+
draft: finalDraft,
|
|
222
|
+
language,
|
|
223
|
+
});
|
|
224
|
+
await writePackageArtifacts(root, baseDir, salesPackage, language);
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
await writeShortRunSnapshot(root, baseDir, {
|
|
228
|
+
storyId,
|
|
229
|
+
status: "failed",
|
|
230
|
+
stage: "draft",
|
|
231
|
+
artifacts: [],
|
|
232
|
+
observations: [],
|
|
233
|
+
error: error instanceof Error ? error.message : String(error),
|
|
234
|
+
}).catch(() => undefined);
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
const coverArtifacts = options.cover === false
|
|
238
|
+
? { coverError: "disabled" }
|
|
239
|
+
: await generateCoverArtifact({
|
|
240
|
+
root,
|
|
241
|
+
baseDir,
|
|
242
|
+
salesPackage,
|
|
243
|
+
language,
|
|
244
|
+
coverBaseUrl: options.coverBaseUrl,
|
|
245
|
+
coverEndpoint: options.coverEndpoint,
|
|
246
|
+
coverModel: options.coverModel,
|
|
247
|
+
coverSize: options.coverSize,
|
|
248
|
+
coverApiKeyEnv: options.coverApiKeyEnv,
|
|
249
|
+
signal: options.signal,
|
|
250
|
+
}).catch((error) => {
|
|
251
|
+
options.signal?.throwIfAborted();
|
|
252
|
+
return { coverError: String(error) };
|
|
253
|
+
});
|
|
254
|
+
const completionWarnings = [
|
|
255
|
+
outlineRevisionWarning ? `outline revision skipped: ${outlineRevisionWarning}` : "",
|
|
256
|
+
revisionWarning ? `draft revision skipped: ${revisionWarning}` : "",
|
|
257
|
+
].filter(Boolean);
|
|
258
|
+
const observations = [
|
|
259
|
+
...buildShortLengthObservations(finalDraft, charsPerChapter, language),
|
|
260
|
+
...completionWarnings.map((warning) => ({
|
|
261
|
+
metric: "optional-revision",
|
|
262
|
+
expected: "completed cleanly",
|
|
263
|
+
actual: warning,
|
|
264
|
+
severity: "warning",
|
|
265
|
+
evidence: warning,
|
|
266
|
+
repairable: true,
|
|
267
|
+
})),
|
|
268
|
+
...(coverArtifacts.coverError && coverArtifacts.coverError !== "disabled"
|
|
269
|
+
? [{
|
|
270
|
+
metric: "cover-generation",
|
|
271
|
+
expected: "cover image generated",
|
|
272
|
+
actual: coverArtifacts.coverError,
|
|
273
|
+
severity: "warning",
|
|
274
|
+
evidence: coverArtifacts.coverError,
|
|
275
|
+
repairable: true,
|
|
276
|
+
}]
|
|
277
|
+
: []),
|
|
278
|
+
];
|
|
279
|
+
const artifacts = [
|
|
280
|
+
join(baseDir, "outline", "v002.md"),
|
|
281
|
+
join(baseDir, "reviews", "draft-v001.md"),
|
|
282
|
+
join(baseDir, "final", "full.md"),
|
|
283
|
+
join(baseDir, "final", "short-story.json"),
|
|
284
|
+
join(baseDir, "final", "sales-package.md"),
|
|
285
|
+
join(baseDir, "final", "cover-prompt.md"),
|
|
286
|
+
...(coverArtifacts.coverImagePath ? [coverArtifacts.coverImagePath] : []),
|
|
287
|
+
].map(projectPath);
|
|
288
|
+
await writeShortRunSnapshot(root, baseDir, {
|
|
289
|
+
storyId,
|
|
290
|
+
status: observations.some((observation) => observation.severity === "blocking")
|
|
291
|
+
? "needs-review"
|
|
292
|
+
: "complete",
|
|
293
|
+
stage: "complete",
|
|
294
|
+
artifacts,
|
|
295
|
+
observations,
|
|
296
|
+
});
|
|
297
|
+
return buildShortRunResult(storyId, baseDir, coverArtifacts);
|
|
298
|
+
}
|
|
299
|
+
function buildShortRunResult(storyId, baseDir, coverArtifacts) {
|
|
300
|
+
return {
|
|
301
|
+
storyId,
|
|
302
|
+
outlinePath: projectPath(join(baseDir, "outline", "v002.md")),
|
|
303
|
+
outlineReviewPath: projectPath(join(baseDir, "reviews", "outline-v001.md")),
|
|
304
|
+
draftReviewPath: projectPath(join(baseDir, "reviews", "draft-v001.md")),
|
|
305
|
+
finalMarkdownPath: projectPath(join(baseDir, "final", "full.md")),
|
|
306
|
+
finalJsonPath: projectPath(join(baseDir, "final", "short-story.json")),
|
|
307
|
+
salesPackagePath: projectPath(join(baseDir, "final", "sales-package.md")),
|
|
308
|
+
coverPromptPath: projectPath(join(baseDir, "final", "cover-prompt.md")),
|
|
309
|
+
coverImagePath: coverArtifacts.coverImagePath,
|
|
310
|
+
coverError: coverArtifacts.coverError,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
async function projectFileExists(root, path) {
|
|
314
|
+
try {
|
|
315
|
+
await access(safeChildPath(root, path));
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async function isFailedShortRun(root, path) {
|
|
323
|
+
const raw = await tryReadProjectText(root, path);
|
|
324
|
+
if (!raw)
|
|
325
|
+
return false;
|
|
326
|
+
try {
|
|
327
|
+
const parsed = JSON.parse(raw);
|
|
328
|
+
return parsed.status === "failed";
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async function tryReadProjectText(root, path) {
|
|
335
|
+
try {
|
|
336
|
+
return await readFile(safeChildPath(root, path), "utf-8");
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
export async function generateShortFictionCover(options) {
|
|
343
|
+
options.signal?.throwIfAborted();
|
|
344
|
+
const title = options.title.trim();
|
|
345
|
+
if (!title) {
|
|
346
|
+
throw new Error("title is required for cover generation.");
|
|
347
|
+
}
|
|
348
|
+
const outputDir = normalizeOutputDir(options.outputDir ?? join("covers", safeSegment(title)));
|
|
349
|
+
const salesPackage = {
|
|
350
|
+
title,
|
|
351
|
+
intro: options.intro?.trim() ?? "",
|
|
352
|
+
sellingPoints: normalizeSellingPoints(options.sellingPoints),
|
|
353
|
+
coverPrompt: options.coverPrompt?.trim() ?? "",
|
|
354
|
+
rawContent: "",
|
|
355
|
+
};
|
|
356
|
+
const promptPath = join(outputDir, "cover-prompt.md");
|
|
357
|
+
const imagePrompt = buildCoverImagePrompt(salesPackage, options.promptMode ?? "generic", options.language);
|
|
358
|
+
await writeText(options.projectRoot, promptPath, imagePrompt);
|
|
359
|
+
const artifact = await generateCoverImageArtifact({
|
|
360
|
+
root: options.projectRoot,
|
|
361
|
+
outputDir,
|
|
362
|
+
salesPackage,
|
|
363
|
+
promptMode: options.promptMode ?? "generic",
|
|
364
|
+
language: options.language,
|
|
365
|
+
coverBaseUrl: options.coverBaseUrl,
|
|
366
|
+
coverEndpoint: options.coverEndpoint,
|
|
367
|
+
coverModel: options.coverModel,
|
|
368
|
+
coverSize: options.coverSize,
|
|
369
|
+
coverApiKeyEnv: options.coverApiKeyEnv,
|
|
370
|
+
signal: options.signal,
|
|
371
|
+
});
|
|
372
|
+
return {
|
|
373
|
+
title,
|
|
374
|
+
outputDir: projectPath(outputDir),
|
|
375
|
+
coverPromptPath: projectPath(promptPath),
|
|
376
|
+
coverImagePath: artifact.coverImagePath,
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
async function writeDraftArtifacts(root, baseDir, version, draft, language = "zh") {
|
|
380
|
+
const draftDir = join(baseDir, "drafts", version);
|
|
381
|
+
await commitAtomicFileSet({
|
|
382
|
+
rootDir: root,
|
|
383
|
+
writes: [
|
|
384
|
+
textWrite(join(draftDir, "full.md"), renderShortFictionDraftMarkdown(draft, language)),
|
|
385
|
+
textWrite(join(draftDir, "draft.json"), JSON.stringify(draft, null, 2)),
|
|
386
|
+
...draft.chapters.map((chapter) => textWrite(join(draftDir, "chapters", `${String(chapter.number).padStart(4, "0")}.md`), [
|
|
387
|
+
`# ${formatShortFictionChapterHeading(chapter.number, chapter.title, language)}`,
|
|
388
|
+
"",
|
|
389
|
+
chapter.content,
|
|
390
|
+
].join("\n"))),
|
|
391
|
+
],
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
async function writeFinalArtifacts(root, baseDir, draft, language = "zh") {
|
|
395
|
+
const finalDir = join(baseDir, "final");
|
|
396
|
+
const markdown = renderShortFictionDraftMarkdown(draft, language);
|
|
397
|
+
await commitAtomicFileSet({
|
|
398
|
+
rootDir: root,
|
|
399
|
+
writes: [
|
|
400
|
+
textWrite(join(finalDir, "full.md"), markdown),
|
|
401
|
+
textWrite(join(finalDir, `${safeFileName(draft.storyTitle)}.md`), markdown),
|
|
402
|
+
textWrite(join(finalDir, "short-story.json"), JSON.stringify(draft, null, 2)),
|
|
403
|
+
...draft.chapters.map((chapter) => textWrite(join(finalDir, "chapters", `${String(chapter.number).padStart(4, "0")}.md`), [
|
|
404
|
+
`# ${formatShortFictionChapterHeading(chapter.number, chapter.title, language)}`,
|
|
405
|
+
"",
|
|
406
|
+
chapter.content,
|
|
407
|
+
].join("\n"))),
|
|
408
|
+
],
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
async function writePackageArtifacts(root, baseDir, salesPackage, language = "zh") {
|
|
412
|
+
const finalDir = join(baseDir, "final");
|
|
413
|
+
const headings = language === "en"
|
|
414
|
+
? { intro: "## Synopsis", sellingPoints: "## Selling Points", coverPrompt: "## Cover Prompt" }
|
|
415
|
+
: { intro: "## 简介", sellingPoints: "## 卖点", coverPrompt: "## 封面提示词" };
|
|
416
|
+
const packageMarkdown = [
|
|
417
|
+
`# ${salesPackage.title}`,
|
|
418
|
+
"",
|
|
419
|
+
headings.intro,
|
|
420
|
+
"",
|
|
421
|
+
salesPackage.intro,
|
|
422
|
+
"",
|
|
423
|
+
headings.sellingPoints,
|
|
424
|
+
"",
|
|
425
|
+
...salesPackage.sellingPoints.map((point) => `- ${point}`),
|
|
426
|
+
"",
|
|
427
|
+
headings.coverPrompt,
|
|
428
|
+
"",
|
|
429
|
+
salesPackage.coverPrompt,
|
|
430
|
+
].join("\n");
|
|
431
|
+
await commitAtomicFileSet({
|
|
432
|
+
rootDir: root,
|
|
433
|
+
writes: [
|
|
434
|
+
textWrite(join(finalDir, "sales-package.json"), JSON.stringify(salesPackage, null, 2)),
|
|
435
|
+
textWrite(join(finalDir, "sales-package.md"), packageMarkdown),
|
|
436
|
+
textWrite(join(finalDir, "cover-prompt.md"), salesPackage.coverPrompt || "(empty)"),
|
|
437
|
+
],
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
function buildShortLengthObservations(draft, target, language) {
|
|
441
|
+
const spec = buildLengthSpec(target, language);
|
|
442
|
+
return draft.chapters.map((chapter) => createRangeObservation({
|
|
443
|
+
metric: `chapter-${chapter.number}-length`,
|
|
444
|
+
actual: countChapterLength(chapter.content, spec.countingMode),
|
|
445
|
+
target: spec.target,
|
|
446
|
+
min: spec.hardMin,
|
|
447
|
+
max: spec.hardMax,
|
|
448
|
+
unit: spec.countingMode,
|
|
449
|
+
evidence: `chapter ${chapter.number}: ${chapter.title}`,
|
|
450
|
+
}));
|
|
451
|
+
}
|
|
452
|
+
async function writeShortRunSnapshot(root, baseDir, input) {
|
|
453
|
+
await writeProductionRunSnapshot({
|
|
454
|
+
rootDir: root,
|
|
455
|
+
runPath: join(baseDir, "status.json"),
|
|
456
|
+
run: createProductionRunSnapshot({
|
|
457
|
+
kind: "short-fiction",
|
|
458
|
+
id: input.storyId,
|
|
459
|
+
status: input.status,
|
|
460
|
+
stage: input.stage,
|
|
461
|
+
artifacts: input.artifacts,
|
|
462
|
+
observations: input.observations,
|
|
463
|
+
...(input.error ? { error: input.error } : {}),
|
|
464
|
+
}),
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
async function generateCoverArtifact(input) {
|
|
468
|
+
return generateCoverImageArtifact({
|
|
469
|
+
...input,
|
|
470
|
+
outputDir: join(input.baseDir, "final"),
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
async function generateCoverImageArtifact(input) {
|
|
474
|
+
const request = await resolveCoverGenerationRequest({
|
|
475
|
+
root: input.root,
|
|
476
|
+
coverBaseUrl: input.coverBaseUrl,
|
|
477
|
+
coverEndpoint: input.coverEndpoint,
|
|
478
|
+
coverModel: input.coverModel,
|
|
479
|
+
coverApiKeyEnv: input.coverApiKeyEnv,
|
|
480
|
+
});
|
|
481
|
+
const size = input.coverSize || process.env.INKOS_COVER_SIZE || "1024x1360";
|
|
482
|
+
const { buffer, extension } = await generateImageFromPrompt(request, buildCoverImagePrompt(input.salesPackage, input.promptMode ?? "short", input.language), size, input.signal);
|
|
483
|
+
const coverPath = join(input.outputDir, extension === "jpg" ? "cover.jpg" : "cover.png");
|
|
484
|
+
await writeBinary(input.root, coverPath, buffer);
|
|
485
|
+
return { coverImagePath: projectPath(coverPath) };
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Generate one image from a free-text prompt via whichever image API the cover
|
|
489
|
+
* config resolves to (gemini / images / responses). Shared by cover generation
|
|
490
|
+
* and the interactive-world (Play) illustration feature so both go through the
|
|
491
|
+
* same provider plumbing.
|
|
492
|
+
*/
|
|
493
|
+
export async function generateImageFromPrompt(request, prompt, size, signal) {
|
|
494
|
+
if (request.api === "gemini") {
|
|
495
|
+
const payload = await generateGeminiCover(request, prompt, signal);
|
|
496
|
+
return { buffer: Buffer.from(payload.base64, "base64"), extension: payload.extension };
|
|
497
|
+
}
|
|
498
|
+
if (request.api === "images") {
|
|
499
|
+
return generateImagesCover(request, prompt, size, signal);
|
|
500
|
+
}
|
|
501
|
+
const endpoint = request.endpoint ?? `${request.baseUrl.replace(/\/+$/u, "")}/responses`;
|
|
502
|
+
const response = await fetch(endpoint, {
|
|
503
|
+
method: "POST",
|
|
504
|
+
headers: {
|
|
505
|
+
"Content-Type": "application/json",
|
|
506
|
+
Authorization: `Bearer ${request.apiKey}`,
|
|
507
|
+
},
|
|
508
|
+
body: JSON.stringify({
|
|
509
|
+
model: request.model,
|
|
510
|
+
input: prompt,
|
|
511
|
+
tools: [{ type: "image_generation", size }],
|
|
512
|
+
}),
|
|
513
|
+
signal,
|
|
514
|
+
});
|
|
515
|
+
const text = await response.text();
|
|
516
|
+
if (!response.ok) {
|
|
517
|
+
throw new Error(`image generation failed: HTTP ${response.status} ${text.slice(0, 500)}`);
|
|
518
|
+
}
|
|
519
|
+
let payload;
|
|
520
|
+
try {
|
|
521
|
+
payload = JSON.parse(text);
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
throw new Error(`image generation returned non-JSON response: ${String(error)}`);
|
|
525
|
+
}
|
|
526
|
+
const imageBase64 = extractResponsesImageBase64(payload);
|
|
527
|
+
if (!imageBase64) {
|
|
528
|
+
throw new Error("image generation response did not include image_generation_call result.");
|
|
529
|
+
}
|
|
530
|
+
return { buffer: Buffer.from(imageBase64, "base64"), extension: "png" };
|
|
531
|
+
}
|
|
532
|
+
export async function resolveCoverGenerationRequest(input) {
|
|
533
|
+
if (input.coverEndpoint || input.coverBaseUrl || process.env.INKOS_COVER_ENDPOINT || process.env.INKOS_COVER_BASE_URL) {
|
|
534
|
+
const endpoint = resolveCoverEndpoint(input.coverEndpoint, input.coverBaseUrl);
|
|
535
|
+
const baseUrl = input.coverBaseUrl || process.env.INKOS_COVER_BASE_URL || endpoint
|
|
536
|
+
.replace(/\/responses\/?$/u, "")
|
|
537
|
+
.replace(/\/images\/generations\/?$/u, "");
|
|
538
|
+
return {
|
|
539
|
+
api: endpoint.includes("/responses") ? "responses" : "images",
|
|
540
|
+
baseUrl,
|
|
541
|
+
endpoint,
|
|
542
|
+
model: input.coverModel || process.env.INKOS_COVER_MODEL || "gpt-image-2",
|
|
543
|
+
apiKey: resolveCoverApiKey(input.coverApiKeyEnv || "INKOS_COVER_API_KEY"),
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
const projectCover = await readProjectCoverConfig(input.root);
|
|
547
|
+
if (!projectCover) {
|
|
548
|
+
throw new Error("cover endpoint is required. Configure cover generation in Studio or set INKOS_COVER_BASE_URL.");
|
|
549
|
+
}
|
|
550
|
+
const preset = resolveCoverProviderPreset(projectCover.service);
|
|
551
|
+
if (!preset) {
|
|
552
|
+
throw new Error(`Unsupported cover service: ${projectCover.service}`);
|
|
553
|
+
}
|
|
554
|
+
const apiKey = await resolveProjectCoverApiKey(input.root, projectCover.service);
|
|
555
|
+
if (!apiKey) {
|
|
556
|
+
throw new Error(`Cover API key is required. Configure a cover key for ${preset.label}.`);
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
api: preset.api,
|
|
560
|
+
baseUrl: projectCover.baseUrl || preset.baseUrl,
|
|
561
|
+
model: input.coverModel || projectCover.model || preset.defaultModel,
|
|
562
|
+
apiKey,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
async function readProjectCoverConfig(root) {
|
|
566
|
+
try {
|
|
567
|
+
const raw = await readFile(join(root, "inkos.json"), "utf-8");
|
|
568
|
+
const parsed = JSON.parse(raw);
|
|
569
|
+
const service = typeof parsed.llm?.cover?.service === "string" ? parsed.llm.cover.service : "";
|
|
570
|
+
if (!service)
|
|
571
|
+
return undefined;
|
|
572
|
+
const baseUrl = normalizeCoverBaseUrl(parsed.llm?.cover?.baseUrl);
|
|
573
|
+
return {
|
|
574
|
+
service,
|
|
575
|
+
...(typeof parsed.llm?.cover?.model === "string" && parsed.llm.cover.model.trim()
|
|
576
|
+
? { model: parsed.llm.cover.model.trim() }
|
|
577
|
+
: {}),
|
|
578
|
+
...(baseUrl ? { baseUrl } : {}),
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
catch {
|
|
582
|
+
return undefined;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
async function resolveProjectCoverApiKey(root, service) {
|
|
586
|
+
const secrets = await loadSecrets(root);
|
|
587
|
+
return secrets.services[coverSecretKey(service)]?.apiKey
|
|
588
|
+
|| secrets.services[service]?.apiKey
|
|
589
|
+
|| process.env[`${service.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase()}_API_KEY`]
|
|
590
|
+
|| "";
|
|
591
|
+
}
|
|
592
|
+
async function generateImagesCover(request, prompt, size, signal) {
|
|
593
|
+
const endpoint = request.endpoint ?? `${request.baseUrl.replace(/\/+$/u, "")}/images/generations`;
|
|
594
|
+
const response = await fetch(endpoint, {
|
|
595
|
+
method: "POST",
|
|
596
|
+
headers: {
|
|
597
|
+
"Content-Type": "application/json",
|
|
598
|
+
Authorization: `Bearer ${request.apiKey}`,
|
|
599
|
+
},
|
|
600
|
+
body: JSON.stringify({
|
|
601
|
+
model: request.model,
|
|
602
|
+
prompt,
|
|
603
|
+
n: 1,
|
|
604
|
+
size,
|
|
605
|
+
}),
|
|
606
|
+
signal,
|
|
607
|
+
});
|
|
608
|
+
const text = await response.text();
|
|
609
|
+
if (!response.ok) {
|
|
610
|
+
throw new Error(`cover generation failed: HTTP ${response.status} ${text.slice(0, 500)}`);
|
|
611
|
+
}
|
|
612
|
+
let payload;
|
|
613
|
+
try {
|
|
614
|
+
payload = JSON.parse(text);
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
throw new Error(`cover generation returned non-JSON response: ${String(error)}`);
|
|
618
|
+
}
|
|
619
|
+
const image = extractImagesGenerationImage(payload);
|
|
620
|
+
if (image?.base64) {
|
|
621
|
+
return {
|
|
622
|
+
buffer: Buffer.from(image.base64, "base64"),
|
|
623
|
+
extension: image.extension,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
if (image?.url) {
|
|
627
|
+
return downloadGeneratedCoverImage(image.url, request.apiKey, signal);
|
|
628
|
+
}
|
|
629
|
+
throw new Error("cover generation response did not include image URL or base64 data.");
|
|
630
|
+
}
|
|
631
|
+
export function extractImagesGenerationImage(payload) {
|
|
632
|
+
const data = payload.data;
|
|
633
|
+
if (!Array.isArray(data))
|
|
634
|
+
return undefined;
|
|
635
|
+
for (const item of data) {
|
|
636
|
+
const record = item;
|
|
637
|
+
if (typeof record.b64_json === "string" && record.b64_json.trim()) {
|
|
638
|
+
return { base64: record.b64_json.trim(), extension: "png" };
|
|
639
|
+
}
|
|
640
|
+
if (typeof record.url === "string" && record.url.trim()) {
|
|
641
|
+
return { url: record.url.trim() };
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return undefined;
|
|
645
|
+
}
|
|
646
|
+
async function downloadGeneratedCoverImage(url, apiKey, signal) {
|
|
647
|
+
const response = await fetch(url, { signal });
|
|
648
|
+
const fallbackResponse = response.status === 401 || response.status === 403
|
|
649
|
+
? await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` }, signal })
|
|
650
|
+
: response;
|
|
651
|
+
if (!fallbackResponse.ok) {
|
|
652
|
+
const text = await fallbackResponse.text();
|
|
653
|
+
throw new Error(`cover image download failed: HTTP ${fallbackResponse.status} ${text.slice(0, 300)}`);
|
|
654
|
+
}
|
|
655
|
+
const contentType = fallbackResponse.headers.get("content-type") ?? "";
|
|
656
|
+
const buffer = Buffer.from(await fallbackResponse.arrayBuffer());
|
|
657
|
+
return {
|
|
658
|
+
buffer,
|
|
659
|
+
extension: coverImageExtension(contentType, url),
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function coverImageExtension(contentType, url) {
|
|
663
|
+
const normalized = `${contentType} ${url}`.toLowerCase();
|
|
664
|
+
return normalized.includes("jpeg") || normalized.includes(".jpg") || normalized.includes(".jpeg") ? "jpg" : "png";
|
|
665
|
+
}
|
|
666
|
+
async function generateGeminiCover(request, prompt, signal) {
|
|
667
|
+
const endpoint = `${request.baseUrl.replace(/\/+$/u, "")}/models/${encodeURIComponent(request.model)}:generateContent?key=${encodeURIComponent(request.apiKey)}`;
|
|
668
|
+
const response = await fetch(endpoint, {
|
|
669
|
+
method: "POST",
|
|
670
|
+
headers: { "Content-Type": "application/json" },
|
|
671
|
+
body: JSON.stringify({
|
|
672
|
+
contents: [{ role: "user", parts: [{ text: prompt }] }],
|
|
673
|
+
generationConfig: { responseModalities: ["IMAGE", "TEXT"] },
|
|
674
|
+
}),
|
|
675
|
+
signal,
|
|
676
|
+
});
|
|
677
|
+
const text = await response.text();
|
|
678
|
+
if (!response.ok) {
|
|
679
|
+
throw new Error(`cover generation failed: HTTP ${response.status} ${text.slice(0, 500)}`);
|
|
680
|
+
}
|
|
681
|
+
let payload;
|
|
682
|
+
try {
|
|
683
|
+
payload = JSON.parse(text);
|
|
684
|
+
}
|
|
685
|
+
catch (error) {
|
|
686
|
+
throw new Error(`cover generation returned non-JSON response: ${String(error)}`);
|
|
687
|
+
}
|
|
688
|
+
const image = extractGeminiImageBase64(payload);
|
|
689
|
+
if (!image) {
|
|
690
|
+
throw new Error("cover generation response did not include Gemini inline image data.");
|
|
691
|
+
}
|
|
692
|
+
return image;
|
|
693
|
+
}
|
|
694
|
+
export function extractResponsesImageBase64(payload) {
|
|
695
|
+
const output = payload.output;
|
|
696
|
+
if (!Array.isArray(output))
|
|
697
|
+
return undefined;
|
|
698
|
+
for (const item of output) {
|
|
699
|
+
const record = item;
|
|
700
|
+
if (record.type === "image_generation_call" && typeof record.result === "string" && record.result.trim()) {
|
|
701
|
+
return record.result.trim();
|
|
702
|
+
}
|
|
703
|
+
if (Array.isArray(record.content)) {
|
|
704
|
+
for (const contentItem of record.content) {
|
|
705
|
+
const contentRecord = contentItem;
|
|
706
|
+
if (typeof contentRecord.result === "string" && contentRecord.result.trim())
|
|
707
|
+
return contentRecord.result.trim();
|
|
708
|
+
if (typeof contentRecord.image_base64 === "string" && contentRecord.image_base64.trim())
|
|
709
|
+
return contentRecord.image_base64.trim();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return undefined;
|
|
714
|
+
}
|
|
715
|
+
export function extractGeminiImageBase64(payload) {
|
|
716
|
+
const candidates = payload.candidates;
|
|
717
|
+
if (!Array.isArray(candidates))
|
|
718
|
+
return undefined;
|
|
719
|
+
for (const candidate of candidates) {
|
|
720
|
+
const parts = candidate.content?.parts;
|
|
721
|
+
if (!Array.isArray(parts))
|
|
722
|
+
continue;
|
|
723
|
+
for (const part of parts) {
|
|
724
|
+
const inlineData = part.inlineData
|
|
725
|
+
?? part.inline_data;
|
|
726
|
+
const record = inlineData;
|
|
727
|
+
if (typeof record?.data !== "string" || !record.data.trim())
|
|
728
|
+
continue;
|
|
729
|
+
const mimeType = String(record.mimeType ?? record.mime_type ?? "image/png").toLowerCase();
|
|
730
|
+
return {
|
|
731
|
+
base64: record.data.trim(),
|
|
732
|
+
extension: mimeType.includes("jpeg") || mimeType.includes("jpg") ? "jpg" : "png",
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return undefined;
|
|
737
|
+
}
|
|
738
|
+
export function resolveCoverApiKey(apiKeyEnv) {
|
|
739
|
+
const apiKey = process.env[apiKeyEnv];
|
|
740
|
+
if (!apiKey) {
|
|
741
|
+
throw new Error(`Cover API key is required. Set ${apiKeyEnv} or pass coverApiKeyEnv.`);
|
|
742
|
+
}
|
|
743
|
+
return apiKey;
|
|
744
|
+
}
|
|
745
|
+
function resolveCoverEndpoint(coverEndpoint, coverBaseUrl) {
|
|
746
|
+
const endpoint = coverEndpoint || process.env.INKOS_COVER_ENDPOINT;
|
|
747
|
+
if (endpoint)
|
|
748
|
+
return endpoint;
|
|
749
|
+
const baseUrl = coverBaseUrl || process.env.INKOS_COVER_BASE_URL;
|
|
750
|
+
if (!baseUrl) {
|
|
751
|
+
throw new Error("cover endpoint is required. Set INKOS_COVER_BASE_URL or disable cover generation.");
|
|
752
|
+
}
|
|
753
|
+
return `${baseUrl.replace(/\/+$/u, "")}/images/generations`;
|
|
754
|
+
}
|
|
755
|
+
function buildCoverImagePrompt(salesPackage, mode, language = "zh") {
|
|
756
|
+
if (language === "en") {
|
|
757
|
+
const base = [
|
|
758
|
+
`Title: ${salesPackage.title}`,
|
|
759
|
+
salesPackage.intro ? `Synopsis: ${salesPackage.intro}` : "",
|
|
760
|
+
salesPackage.sellingPoints.length > 0 ? `Selling points: ${salesPackage.sellingPoints.join("; ")}` : "",
|
|
761
|
+
salesPackage.coverPrompt ? `User visual notes: ${salesPackage.coverPrompt}` : "",
|
|
762
|
+
].filter(Boolean);
|
|
763
|
+
if (mode === "generic") {
|
|
764
|
+
return [
|
|
765
|
+
"Generate a cover image from the title, synopsis, selling points, and visual notes the user provided.",
|
|
766
|
+
...base,
|
|
767
|
+
].join("\n");
|
|
768
|
+
}
|
|
769
|
+
return [
|
|
770
|
+
"Generate a mobile portrait book cover for an English short story, 3:4 vertical.",
|
|
771
|
+
...base.map((line) => line.replace(/^Title: /u, "Main title: ").replace(/^User visual notes: /u, "Packaging notes: ")),
|
|
772
|
+
"",
|
|
773
|
+
"Cover direction: a platform short-fiction book cover, not a movie poster. The title lettering is the primary visual — reserve a large two-to-four-line type zone; character in close-up or half-body with a charged expression (cold smirk, shock, breakdown, menace, or payback); props few but large, telegraphing the conflict at a glance.",
|
|
774
|
+
"High-contrast, high-saturation colors that read as a phone-list thumbnail. Avoid realistic corporate photography, landscape video thumbnails, magazine editorial looks, delicate thin lettering, and long runs of text.",
|
|
775
|
+
"If the model's text rendering is unreliable, prioritize a clear title whitespace/type-block/layout zone instead of covering the canvas with garbled lettering.",
|
|
776
|
+
].filter(Boolean).join("\n");
|
|
777
|
+
}
|
|
778
|
+
const base = [
|
|
779
|
+
`标题:${salesPackage.title}`,
|
|
780
|
+
salesPackage.intro ? `简介:${salesPackage.intro}` : "",
|
|
781
|
+
salesPackage.sellingPoints.length > 0 ? `卖点:${salesPackage.sellingPoints.join(";")}` : "",
|
|
782
|
+
salesPackage.coverPrompt ? `用户视觉要求:${salesPackage.coverPrompt}` : "",
|
|
783
|
+
].filter(Boolean);
|
|
784
|
+
if (mode === "generic") {
|
|
785
|
+
return [
|
|
786
|
+
"按用户给出的标题、简介、卖点和视觉要求生成封面图。",
|
|
787
|
+
...base,
|
|
788
|
+
].join("\n");
|
|
789
|
+
}
|
|
790
|
+
return [
|
|
791
|
+
"为中文短篇小说生成手机端竖版书封,3:4竖图。",
|
|
792
|
+
...base.map((line) => line.replace(/^标题:/u, "主标题:").replace(/^用户视觉要求:/u, "包装提示:")),
|
|
793
|
+
"",
|
|
794
|
+
"封面方向:平台短篇书封,不是电影海报。标题字要成为主视觉,预留两到四行大字排版区;人物近景或半身,表情有冷笑、震惊、崩溃、压迫或反杀感;道具少而大,一眼能看出冲突。",
|
|
795
|
+
"颜色高对比、高饱和,适合手机列表缩略图。避免写实会议摄影、横版视频缩略图、杂志大片、小清新细字和长段文字。",
|
|
796
|
+
"如果模型文字不稳定,优先生成明确标题留白/字块/排版空间,不要把大量乱码文字铺满画面。",
|
|
797
|
+
].filter(Boolean).join("\n");
|
|
798
|
+
}
|
|
799
|
+
function normalizeSellingPoints(value) {
|
|
800
|
+
if (typeof value === "string" || value === undefined) {
|
|
801
|
+
return (value ?? "")
|
|
802
|
+
.split(/[;;\n]/u)
|
|
803
|
+
.map((point) => point.trim())
|
|
804
|
+
.filter(Boolean);
|
|
805
|
+
}
|
|
806
|
+
return value.map((point) => point.trim()).filter(Boolean);
|
|
807
|
+
}
|
|
808
|
+
async function writeBinary(root, path, value) {
|
|
809
|
+
const resolved = safeChildPath(root, path);
|
|
810
|
+
await mkdir(dirname(resolved), { recursive: true });
|
|
811
|
+
await writeFile(resolved, value);
|
|
812
|
+
}
|
|
813
|
+
function textWrite(relativePath, value) {
|
|
814
|
+
return {
|
|
815
|
+
relativePath,
|
|
816
|
+
content: `${value.trimEnd()}\n`,
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
async function writeText(root, path, value) {
|
|
820
|
+
const resolved = safeChildPath(root, path);
|
|
821
|
+
await mkdir(dirname(resolved), { recursive: true });
|
|
822
|
+
await writeFile(resolved, `${value.trimEnd()}\n`, "utf-8");
|
|
823
|
+
}
|
|
824
|
+
function normalizeOutputDir(value) {
|
|
825
|
+
const trimmed = value.trim() || "shorts";
|
|
826
|
+
const normalized = projectPath(trimmed).replace(/^\/+/u, "").replace(/\/+$/u, "") || "shorts";
|
|
827
|
+
safeChildPath("/", normalized);
|
|
828
|
+
return normalized;
|
|
829
|
+
}
|
|
830
|
+
function boundedInteger(value, fallback, name, min, max) {
|
|
831
|
+
const parsed = value ?? fallback;
|
|
832
|
+
if (!Number.isInteger(parsed) || parsed < min || parsed > max) {
|
|
833
|
+
throw new Error(`${name} must be an integer between ${min} and ${max}.`);
|
|
834
|
+
}
|
|
835
|
+
return parsed;
|
|
836
|
+
}
|
|
837
|
+
function slugify(value) {
|
|
838
|
+
const slug = value
|
|
839
|
+
.toLowerCase()
|
|
840
|
+
.replace(/['"]/g, "")
|
|
841
|
+
.replace(/[^\p{L}\p{N}]+/gu, "-")
|
|
842
|
+
.replace(/^-+|-+$/g, "")
|
|
843
|
+
.slice(0, 60);
|
|
844
|
+
return slug || `short-${Date.now()}`;
|
|
845
|
+
}
|
|
846
|
+
function safeSegment(value) {
|
|
847
|
+
const cleaned = value
|
|
848
|
+
.replace(/[\\/:\0*?"<>|]/g, "-")
|
|
849
|
+
.replace(/\s+/g, "-")
|
|
850
|
+
.replace(/^-+|-+$/g, "")
|
|
851
|
+
.slice(0, 80);
|
|
852
|
+
if (!cleaned || cleaned === "." || cleaned === "..")
|
|
853
|
+
return `short-${Date.now()}`;
|
|
854
|
+
return cleaned;
|
|
855
|
+
}
|
|
856
|
+
function safeFileName(value) {
|
|
857
|
+
const cleaned = value
|
|
858
|
+
.replace(/[\\/:\0*?"<>|]/g, "_")
|
|
859
|
+
.replace(/\s+/g, " ")
|
|
860
|
+
.trim()
|
|
861
|
+
.slice(0, 80);
|
|
862
|
+
return cleaned || "short-fiction";
|
|
863
|
+
}
|
|
864
|
+
//# sourceMappingURL=short-fiction-runner.js.map
|